Welcome back everybody! It has been quite some time since I last posted some Creo 4.0 with PowerShell magic and I had the craving to invest more time into it. Today, I would like to introduce you to a PowerShell function that can be used to automate the exporting of family table instances to stand-alone files. Why do you need this? I have encountered a lot of customers who either use family tables correctly and don't like them or don't use them correctly and hate them. There was and is an obvious need to allow people to quickly "unzip" family tables into their individual instances. Is this really all I need? No. All this function does is export the instances to individual files. You still need to point your assemblies to reference those newly exported files. Maybe I will show you how to do this in another section but I encourage you to try to figure out the other 50% yourself. If you keep waiting for someone to do it for you, you will never learn. How do I use this function? In Part 1, I showed you how to get things setup. In Part 3, I showed you how to iterate models through a loop. You simply need to put the below function in your scripts (that I am sure YOU made YOUR OWN by now) and push your files through the function. Anything I should look out for? Like my other scripts, there isn't any error checking. There also isn't anything that prevents newly saved instances from overwriting existing saved instances that have the same name. I'm not going to give everything away! I suggest you add these critical pieces to your own code. This is basic stuff that PowerShell users should be able to handle. Other than that, read the comments in the code below for more details. Important! When pushing assembly based family tables through the function, all parts and subassemblies will be copied to the export path. You need to build in a check to make sure you aren't overwriting any files that are already there. This will also export the family table of any subcomponents rather than just the instance so your export path will have family table files as a result. Family Table Instance Export Function
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorErick Johnson Archives
May 2024
Categories
All
|