Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate Drawings from Spreadsheet 2

Status
Not open for further replies.

jclever20

Industrial
Jul 19, 2011
11
I have been trying to automate a process of making around 2000 drawings with dimensions in an excel spreadsheet. I have a master template but need to change a few dimensions in each drawing.I have tried to use part families but I can not effeciently generate drawings using this method. Is there a better way to import/link the spreadsheet data to these parts?

Jake Clever
Product Engineer
 
Replies continue below

Recommended for you

Are we talking about changing the dimensions of a model and then have the drawing update accordingly or are we trying to directly drive the text in dimensions on a drawing?

And what version of NX are you using?

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
I would like for the dimensions of the model to change and save a .pdf for each iteration from the spreadsheet.

I am using version 5 but have version 7.5 capability if there is a newer function to make this possible.
 
If your real 'ouput' in merely the 2000 PDF's, perhaps it might be better to create a template model with an imbedded drawing (there are situations where Master Model may not always provide any advantage, with this example being one of them) and then write an NX Open application which would open the template part, read the relevant expression value(s) from an external Spreadsheet, update the model and drawing, export a PDF and then optionally save a copy of the current manifestation of your template part giving it a new name (which could also have been read from the Spreadsheet) if it was important to actually have a copy of each of the 2000 manifestations saved on disk. If not, then just read another set of records, update, export the PDF and continue until all 2000 records have been read and the 2000 PDF files have been created and saved.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Attached is a sample program which demonstates coding for the procedure outlined by JohnRBaker.

Included is a part file (model1.prt) which is NX7.5 part. This part has a simple block in it and a drawing with two dimensioned views of the block.

The xls data for three versions of the block are included in data1.xlsx. The program looks for this xls file in C:\temp\

To read the xls file we need to use a Microsoft namespace. This means the program cannot be run as a journal. I have included the source code (PDFCreate.txt). Just change the txt extension to vb for reference. The pdfcreate.dll has been signed so that the sample program can be run (NX7.5).

Frank Swinkels

 
 http://files.engineering.com/getfile.aspx?folder=78c08f03-c4af-4c31-9447-6629fb36d9fc&file=pdfcreate.zip
Frank,
Thank you for the sample program. I tried to execute it but it came back with an error, most likely due to something I am doing despite your efforts. I appologize for that. I have attached a picture of what I am getting back from NX when I execute the program as an NX open.

Thanks for all your help!

Jake Clever
 
 http://files.engineering.com/getfile.aspx?folder=5ab1b4bc-436f-4ba8-aa76-aaf900dbbe0f&file=NX_Error.JPG
I think what may have been missing from your system is the Microsoft.Office.Interop.Excel.dll file (I think). What I have done is included the above file. I have also changed the code so that it looks for this library in C:\temp. Please place this file also in C:\temp. I have also added two error checking.

Hope this now works.

Frank Swinkels
 
 http://files.engineering.com/getfile.aspx?folder=199b1125-af9a-4e0d-97de-16acd4794576&file=pdfcreateupdate.zip
The application is still stopping at the excel open with the msgbox you sent up. I am trying to edit and rebuild but without much luck.
 
One more try. I have used a different version of Microsoft.Office.Interop.Excel.dll. If this does not work then I don't have the appropriate library file for your version of Microsoft Office (What is your version?).

Frank Swinkels
 
 http://files.engineering.com/getfile.aspx?folder=395e3cf6-5b09-4a6c-9da6-6272ce4a99b3&file=pdfcreateThurs28July.zip
I am using office 12.(2007) Still no luck. I will try some modifications and possibly do a read from excel with it opened manually.

Thank you for all your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor