API: Iterate configs, delete suppressed features - save file as each config

I need iterate through the configurations in an active part/assembly, delete each of the suppressed features - saving separate files for each configuration.

My code correctly deletes all suppressed features - except folders containing those features. Here's the important code:

Part.ClearSelection Set Feature = Part.FirstFeature While Not Feature Is Nothing Set subFeat = Feature.GetFirstSubFeature While Not subFeat Is Nothing If subFeat.IsSuppressed Then subFeat.Select (True) Set subFeat = subFeat.GetNextSubFeature Wend If Feature.IsSuppressed Then Feature.Select (True) Set Feature = Feature.GetNextFeature() Wend Part.DeleteSelection (False) Call SaveFile(Part, config)

What am I missing? Why wouldn't folders be deleted as features? Is there a dedicated method which deals with folder creation/deletion that I can't find?

Reply to
Loading thread data ...

I also made a macro that saves the various configurations. See "SplitConfigs.zip" on

formatting link
it doesn't delete suppressed features (yet). The "suppressed" attribute of the folder is independent from its content's. You can have a non-suppressed folder that contains only suppressed features. So while traversing a folder's sub-features, you should check if they are all suppressed, and delete the folder in this case afterwards. Notice also that deleting a folder doesn't delete the sub-features at the same time. BTW I think your approach to delete the features then save the file is wrong : your program will delete features that are unsuppressed in other configs not yet saved. You have to do it in 2 steps:

1) save one file for each config 2) delete the suppressed features in each file. Once it works, I would be happy to make it available on my site, with credits to you.
Reply to
Philippe Guglielmetti

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.