Welcome Creo users/hackers!
There doesn't seem to be much out there when it comes to using PowerShell with Creo. I will shed some light on this topic and attempt to explain each line so that you can finally start automating Creo related tasks all on your own.
Part 1 of a multi-part series deals with the basics. You will learn how to install the appropriate toolkit, configure it to work, and do some basic tasks in Creo like opening a file.
Step 1: Installation
Now I can't tell you what license you need, if any, to use this because I have a special "everything and anything" license. It is possible you only need one when you start selling an app and anyone is allowed to install and build apps for free. Anyways, to install, you first download the Creo media and click on Customize.
In the "Creo Parametric" section and under the "Application Features" tab, check the box next to "VB API for Creo Parametric" under the "API Toolkits Section".
Step 2: Configuration
Once it is done installing. Browse to <Creo Installation Directory>\<Datecode>\Parametric\bin and run the "vb_api_register.bat" script as an Administrator.
Next, you need to go to Control Panel\System and Security\System -> Advanced system settings -> Advanced -> Environment Variables... and add a new system variable:
Step 3: Making Your First Script
Open a Windows PowerShell ISE Window. I like the ISE because it gives a nice interface to write and save a script for later use. I am going to get straight to the code and comments.
If you run the script with the last line "$connection.End()" commented out, you should get the below result with your given file.
Now you know how to open and save files. Part 2 will discuss exporting files to third party formats.
PLM engineer while "on the clock", programmer, designer, dreamer all other times.