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

Hi Darren,

 

Can you try my VBA code there? You can add the logic for check the derived assembly in the code to make it work for both derived part and assembly.

 

I noticed that in your code, the last argument you use the AssemblyDocument but not ComponentOccurrence in the function HideAllDerivedPartsInSelectedView:

 

Function HideAllDerivedPartsInSelectedView(ByRef SelectedView As Inventor.DrawingView, ByVal ShowParts As Boolean, ByRef SubAssemblyDoc As Inventor.AssemblyDocument) As Boolean

 

Here I think what you should pass in is a ComponentOccurrence object for the sub assembly but not the AssemblyDocument object, and also in the code  where you iterate the sub-occurrences you should also use the ComponentOccurrence.SubOccurrences to get the ComponentOccurrenceProxy objects and pass in the ComponentOccurrenceProxy for the SetVisibility method. You can refer to the logic in my VBA code how I iterate the SubOccurrences but not the AssemblyDocument.ComponentDefinition.Occurrences. If you still have problem to update your code please let me know.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.