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

Oct 11, 2003 1 Replies

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?



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.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required