03-13-2023
08:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-13-2023
08:58 AM
Hi @anandax. Are you simply wanting a rule that will un-suppress every component in every level of the assembly, without any other requirements or checks? If you want to work with ComponentOccurrence objects, and you want your code to reach all levels of an assembly structure, then you will need a recursive sub routine. Below is a very basic example of a rule like that with no error checking/handling.
Sub Main
Dim oADoc As AssemblyDocument = ThisDoc.Document
Dim oOccs As ComponentOccurrences = oADoc.ComponentDefinition.Occurrences
RecurseComponents(oOccs)
End Sub
Sub RecurseComponents(oComps As ComponentOccurrences)
If IsNothing(oComps) OrElse oComps.Count = 0 Then Exit Sub
For Each oComp As ComponentOccurrence In oComps
If oComp.Suppressed Then oComp.Unsuppress
If oComp.SubOccurrences.Count > 0 Then
RecurseComponents(oComp.SubOccurrences)
End If
Next
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS)
.
Wesley Crihfield
(Not an Autodesk Employee)