Hello again Creo fans!
I've been encountering a lot of migration type work requests lately and there always seems to be issues with the data that is trying to be put into Windchill. I have taken it upon myself to start making some high level scripts to get you going in regards to cleaning up your data before you get it into Windchill. The first of (many?) scripts to come deals with regeneration errors and locating missing components. Check it out and stay tuned for more.
The very first thing you should always do before you even start thinking about moving data into Windchill is to make sure you have all of it. I am going to assume you know how to set your config.pro "search_path" option and recommend that you set it to all known locations of where your Creo data resides. Remember, use quotes and commas to deal with multiple paths and spaces i.e. search_path = "E:\My Creo Files", "Y:\Company Creo Files". If you used my script from Part 5 then you should set your search_path to the latest files folder you made with it.
High Level Overview of Script:
There is no code in my script that handles drawings or regeneration errors that do not deal with missing files. You have to figure this part out (I'm not going to give everything away).
The Regeneration Check:
In order to use the Creo API to check for regeneration issues, you must set the config.pro option "regen_failure_handling" to "resolve_mode". It will not work otherwise. My script will automatically do this for you.
Now, the regeneration test is fairly simple:
The results from a successful regeneration:
The results from a failed regeneration:
Unfortunately, I haven't found a way to get more details than this so you need to go through the model and find out the specific errors. Fear not! My script does this automatically for you (at least for missing files)!
Checking For Missing Files (missingTest Function):
This function will go through all subassemblies and find any missing parts or assemblies. The resulting csv shows a list of the hierarchy of all missing files starting from the root file at level 0. Below is an example of a files missing components and the resulting csv.
Locating Missing Files (findMissingFile Function):
This function cycles through all the missing files and attempts to locate them in the search paths you provide in the beginning if you tell it to search. This will add time to the script but it makes it easier to just run it and walk away. Three thing will happen:
Final Regeneration Test:
If the original parent assembly failed regeneration and if all missing files were found, then a 2nd and final regeneration attempt will be made. Failure at this stage usually means regeneration issues exist that don't revolve around missing files. You will need to perform similar tasks to try and figure it out. This script does not account for other regeneration errors.
Final Regeneration Status Log:
At the very end, a log called "RegenLog.csv" will show to high level status of all files tested. This is meant to be a quick summary showing the current status of each file.
Now you have a new powerful tool that gives you more time to do actual work. There are quite a few ways you can optimize this script for it to run faster but part of the fun is adding your own contributions so I won't go into anymore details.
Make sure to comment below, like, tell me about errors, etc. I have only used this on some very controlled data and I can't imagine it running perfectly on very large and complex models. Keep checking back for me!
PLM engineer while "on the clock", programmer, designer, dreamer all other times.