Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
539 Views, 4 Replies

Turn off component visibility for all instances in top asy and sub asy.

Hello All,

 

Background on the request

There are times where I need to 'hide' or turn off the visibility of all instances of a certain component (to confirm part alignments etc), while working in the top level assembly.  This can amount to hundreds of instances and is very tedious when having to manually select each component in each sub assembly and turn off the assembly.  I am trying to create a rule that will 'automatically' turn off the visibility of so called component in the top level assembly, as well as any subsequent sub assemblies.  

 

I have a rule written that will turn off the visibility of all instances within the current open assembly, but it will not 'drill down' into the sub assemblies and hide the component.  The code that I currently have is pasted below.  

 

I have yet to figure this out.  I've tried traverse assemblies as well as recursive, but with no luck.  I'm a very new to the inventor ilogic customization, so my knowledge is limited, if not non-existing.

 

Any help will be greatly appreciated.

 

Thanks!

 

 

 

'Get the set of occurrences in this assembly document
oOccurrences = ThisApplication.ActiveDocument.ComponentDefinition.Occurrences

'Cycle through each component in the set
For Each oComp As ComponentOccurrence In oOccurrences
'Get the browser name of the component
oCompName = oComp.Name
'Check if the desired bit of text is in the component's name
If InStr(oCompName, "ComponentX") > 0 Then
If oComp.Visible = True Then
oComp.Visible = False
Else

End If
End If
Next