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.
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.