I have an assembly which includes lot of parts (*.ipt) or sub-assembly (*.iam).
I have some ilogic rules to control to suppress or unsuppress them.
Now for the released assembly, I want delete all suppressed components by ilogic rule.
Could anybody help me the ilogic code to get this function?
Solved! Go to Solution.
Dim oComp As ComponentOccurrence Dim oComps As ComponentOccurrences oComps = ThisDoc.Document.ComponentDefinition.Occurrences For Each oComp In oComps If Component.IsActive(oComp.Name) = False Then oComp.Delete Next
Hi Mike, by any chance do you know how to do the same but for deleting suppressed features in the part environment?
Dim oFeature As PartFeature Dim oFeatures As PartFeatures oFeatures = ThisDoc.Document.ComponentDefinition.Features For Each oFeature In oFeatures If Feature.IsActive(oFeature.Name) = False Then oFeature.Delete Next
Thanks lot, Mike.
For deleting features, do you know how to delete the relative sketches?
I tested the codes, it could delete features, but the sketches are still in the tree.
When I tested it the code deleted the consumed sketches as well as the feature. Can you attach the model?
Here is a simplified model.
Did you already run your delete features sub on this part? The code doesn't do anything at all for me.
Yes, I did. This is the result after runing the code.