Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: anandax

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) :thumbs_up:.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)