Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

drawing to dxf journal

Status
Not open for further replies.

cowski

Mechanical
Apr 23, 2000
8,177
After a few days of messing around with 2D exchange and dxf export options in hope of getting accurate, fast, and consistent dxf exports of our drawings, I have given up and am falling back on the tried and true method of exporting a cgm and then exporting a dxf of that. To help automate this process, I wrote a journal file (attached). The output will be dxf file(s); the journal handles multi-sheet drawings as multiple dxf file output. If you have part '12345_dwg.prt' which has 2 drawing sheets, the output will be '12345_dwg_1.dxf' and '12345_dwg_2.dxf'.

Near the beginning of the journal there is a string constant defined which is the path to your 'dxfdwg.def' file. Change this to the location of your file then save the journal and run it when needed.

I could use some help/feedback on 2 main areas:

1) bug hunting: while it has been pretty stable in my testing, I don't guarantee it to be bulletproof. Please respond with any bugs or problems you experience. Probably the most common error you will get is the dxf translator telling you 'file not found' (more about that below); if this is the case try increasing the number in the 'sleep' statment.

2)suggestions for improvements: specifically the journal could use a better way to wait for the dxf translator to finish. When I added the lines to clean up the temp files created, I found out that the dxf translator is started asynchronously (ie the rest of the journal doesn't wait for the translator to finish before it plows through the rest of the commands). I added a 'sleep' statement in the main loop (basically a 'hack' to get it to work) which has worked on the files I tested with, but depending on your computer specs and the files you translate may not work 100% of the time. Eliminating the temp file cleanup would solve the problem but would require some tedious 'seek and destroy' missions later.

 
I did a similar journal some time ago, and in order to get the required output for auto-bad, i had to change the colour of all the curves to white, then rotate the whole thing by 90' about the X-axis so that it was then exported on the X-Z axes which apparently opens fine in auto-bad !!
 
Attached is an improved version. Instead of exporting to the same folder as the original file, a 'browse for folder' dialog box opens allowing you to choose where the output goes. Also, I think I eliminated problem #2 (see first post); if not, let me know.

 
 http://files.engineering.com/getfile.aspx?folder=2e6a77cf-3cfb-4b32-83e8-ae320293978c&file=drawing_to_dxf.vb
Cowski,
When i read thru the code, i noticed that it loads into the "BLANK" template, and since i turn that option off in my defaults, and use my own start-part (in startup folder), i had to set it back on to be able to use the .vb , Is there an easy way for me to add a path and file name so it won't need to look for the BLANK file?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor