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

@mike.krudt 

 

you can try this one for Material,

 

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition


Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences

If iProperties.MaterialOfComponent(oOccurrence.Name) = "Steel"
  
		  oOccurrence.Visible = False
 Else

End If
Next

 

To looping thru all occurance, it's bit gerneric but you can modify it for your need,

 

Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument

Dim oAsmDef As AssemblyComponentDefinition
oAsmDef = oAsmDoc.ComponentDefinition
Dim oLeafOccs As ComponentOccurrencesEnumerator
oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences

Dim oOcc As ComponentOccurrence
For Each oOcc In oLeafOccs
   'add previous rules

Next

Bhavik Suthar