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

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

Anonymous

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

Anonymous
Not applicable

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

 

 

0 Likes
Reply
540 Views
4 Replies
Replies (4)

LukeDavenport
Collaborator
Collaborator

 

Hi crenshap,

You could save yourself some time and get hold of the View Rep Hero app from the Inventor App Store here:

 

https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3aviewrephero_wi...

 

It'll let you create an instant dynamic filter for removing all instances of a specific Part Number recursively through an entire assembly. And it's very quick.

Thanks,

Luke

0 Likes

Anonymous
Not applicable

LukeDavenport,

 

Thanks for the suggestion.  However, we are trying to avoid having to purchase any software, and instead develop an in-houlse rule than can be used by mulitple users.  Also, once I am able to create the Irule, then it may be modified in the future to suit other needs. If it were only a few users, the software may be viable, but due to the large number of users and the specific application, an Irule will be our best route.

0 Likes

rhasell
Advisor
Advisor

Hi

 

I went though an exhaustive process with Curtis on this one. He wrote so much code trying to help me with this, which worked 99% of the time. The biggest issue was it was incredibly CPU intensive and killed my machine for up to 10 minutes while the code ran. (Thank to Curtis, this got me into iLogic)

 

At the end of the day, I found that creating a custom search in the assembly worked the best.  Save your various search filters and run them when you need them. Then its a simple RMB and toggle visibility. The only bug, is you cant select 'On' or 'Off' when some of the items are already toggled, so you may have to perform the process twice.

 

 

Reg
2025.2
0 Likes

Anonymous
Not applicable

Thanks all for the help.  I was able to work out a rule that accomplished what I was trying to do, and it doesn't seem to take much more than 10 seconds or so to iterate through the top level, as well as any/all subsequent sub assemblies. 

0 Likes