Delete all supressed in subassembly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a assembly with al lot of subassemblies and parts.
Different parts, subassemblies are supressed.
Also varies parts in the subassemblies have supressed parts in it.
Now i want to delete all the supressed parts in the top-assembly, but also in the subassemblies.
I have a rule wich can delete the patterns and the supressed parts.
But the problem is that this rule will only work on the top-assembly.
How can i delete all the supressed parts in the subassemblies?
This is my rule so far:
'Delete all supressed patterns
Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim oAsmDef As AssemblyComponentDefinition _
= oAsmDoc.ComponentDefinition
RunAgain:
oAsmDoc.Update
Dim oOccs As ComponentOccurrences = oAsmDef.Occurrences
For Each oOcc As ComponentOccurrence In oOccs
If oOcc.Suppressed Then
If oOcc.IsPatternElement Then
Dim oPattern As RectangularOccurrencePattern _
= oOcc.PatternElement.Parent
oPattern.Delete
Goto RunAgain
End If
End If
Next
'Delete all supressed parts
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