For part 2, I am going to show you how to automate exporting Creo files to some of the typical third party formats such as PDF, DXF, and STP. Step 1: Choosing Your Export Options from the GUI This is the part where you really need to pay attention to the UI screens that you use when you save files as a third party format. There are quite a few options listed in the menus that popup. Step 2: Find Equivalent Option Type in the API Guide Once you decide on what options you want, you need to find them in the API User's Guide. You can also use PowerShell IntelliSense to see what is available. Step 3: Figure Out Value for Option This can be a tough one to figure out. It appears that some of the options values listed in the API Guide have an integer value in the API framework. It seems to start at 0 on the first. Some option values will be simple such as bool options and some will take trial and error to get the right argument conversion. For PDF, I want to set the export mode to 3D. My option type is: PDFOPT_EXPORT_MODE and the value I want in the guide is PDF_3D_AS_U3D_PDF. The equates to 2 when starting from 0 on the first value listed in the guide. Keep in mind that as much of a pain as this can be, you must define at least one option. I have not found a way to simply export without creating and properly defining the option object. $null does not work. Step 4: The Code I am going to let the code comments explain what is going on. I have pasted just the functions for working 3DPDF, STEP, and DXF files. You can add these functions the the script from Part 1 to automate the entire thing. 3D PDF - Export Function
DXF - Export Function
STEP - Export Function
2 Comments
Andreas
7/20/2017 02:15:42 am
Hy! I would like to export a STEP from an Assembly - how can i do it?
Reply
Helmut
2/26/2021 04:48:05 am
Hello Erik,
Reply
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorErick Johnson Archives
May 2024
Categories
All
|