I have hundreds of Catia V5 catparts and catproducts in a folder on hard disc. I want to know if a particular catpart is used in some catproduct or not. If it is not used in any product, I want to delete it and clean my hard disc. One way to do it is to open all catproducts one by one and check carefully they contain this model. This is cumbersome process and can lead to serious mistakes. Is there some automatic way to check it? If not, is it possible to write some macro for that purpose?
Asked
Active
Viewed 727 times
1 Answers
0
It is possible with a VBA script. If it's just Catpart file that your looking for in a product, then your script would work as follows
- query your folder(s) for all catparts and catproducts.(use 2 dictionaries or arrays, one for each file type each)
- Via a loop, Individually open and load each catproduct and essentially walk the tree and compare each child Catpart to your compiled list of catparts. If a match is found, movethe part to a new "white list"(dictionary or array)
- Close the catproduct and check the next one.
- Then, when all done, your original list(dictionary or array) will be your unused parts.
I'm not sure exactly how your models are built, but you may need to check for additional references/links in your catproducts (additional logic) before doing something like this.

GisMofx
- 982
- 9
- 27