Erick's Blog
  • Home
  • Blog
  • Apps
    • Mortgage Calculator
  • PowerShell
    • Blog & Examples
    • Excel Reference
  • Windchill
    • Document Exporter
    • Document Worker
    • E.P.L.E.S.
    • Export Released
    • Property Checker
    • Windchill Business Analytics >
      • Part 01 - Program Logic
      • Part 02 - Getting Data with SQL Queries
      • Part 03 - Automating SQL Queries
      • Part 04 - Converting SQL Results to XML
      • Part 05 - Data Processing and Manipulation
      • Part 06 - Displaying XML in HTML
      • Part 07 - Auto Updating Displayed Data
      • Part 08 - Hosting Webpage with an Existing Apache Installation
      • Part 09 - Running Multiple Queries In Sequence
      • Part 10 - Calculating Data Trends
      • Part 11 - Making It Modular
    • Windchill Quick View
  • Reviews
  • Music
  • Contact

Creo 4.0 and PowerShell - Part 2: Exporting to Third Party Formats

1/23/2017

2 Comments

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

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

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?
greets

Reply
Helmut
2/26/2021 04:48:05 am

Hello Erik,

your guidance was excellent. I did it with 2D PDF and 2D DXF. Can I still set an option so that several sheets can be created as separate files for DXF? Is that also possible with pictures? (jpg, png, ....) Thank you very much

Best regards

Helmut

Reply



Leave a Reply.

    Author

    PLM engineer while "on the clock", programmer, designer, dreamer all other times.

    Archives

    July 2017
    May 2017
    February 2017
    January 2017
    December 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016

    Categories

    All
    ASP.NET
    Batch Script
    C#
    Career
    Computers
    Creo
    Creo API
    Flash
    GameMaker
    GitHub
    Home Loan
    How To
    HTML5
    Java
    JavaScript
    MAME
    Mortgage
    Music
    .NET Core
    Office
    PC Games
    PfSense
    PowerShell
    Reviews
    Robot
    SQL
    Video Games
    Web App
    Windchill
    Windchill API

    RSS Feed

Copyright © 2018 Erick Johnson
  • Home
  • Blog
  • Apps
    • Mortgage Calculator
  • PowerShell
    • Blog & Examples
    • Excel Reference
  • Windchill
    • Document Exporter
    • Document Worker
    • E.P.L.E.S.
    • Export Released
    • Property Checker
    • Windchill Business Analytics >
      • Part 01 - Program Logic
      • Part 02 - Getting Data with SQL Queries
      • Part 03 - Automating SQL Queries
      • Part 04 - Converting SQL Results to XML
      • Part 05 - Data Processing and Manipulation
      • Part 06 - Displaying XML in HTML
      • Part 07 - Auto Updating Displayed Data
      • Part 08 - Hosting Webpage with an Existing Apache Installation
      • Part 09 - Running Multiple Queries In Sequence
      • Part 10 - Calculating Data Trends
      • Part 11 - Making It Modular
    • Windchill Quick View
  • Reviews
  • Music
  • Contact