how could I use these functions "AssemblyAllVisibleDesignViewCmd" and "AssemblyAllInvisibleDesignViewCmd " to show and hide all parts?
Solved! Go to Solution.
You may use Commandmanager oblect to execute Inventor commands:
Sub Vis_1() Dim oControlDef As ControlDefinition Set oControlDef = ThisApplication.CommandManager _ .ControlDefinitions.Item("AssemblyAllVisibleDesign
ViewCmd") oControlDef.Execute End Sub Pub Vis_2() Dim oControlDef As ControlDefinition Set oControlDef = ThisApplication.CommandManager _ .ControlDefinitions.Item("AssemblyAllInvisibleDesi gnViewCmd") oControlDef.Execute End Sub
Both commands work only for selected design view representation.
Alternative approach is the use of methods ShowAll and HideAll of the object DesignViewRepresentation:
Sub Vis_3() Dim oAssyDoc As AssemblyDocument Set oAssyDoc = ThisApplication.ActiveDocument Dim oAssyDef As AssemblyComponentDefinition Set oAssyDef = oAssyDoc.ComponentDefinition Dim oMgr As RepresentationsManager Set oMgr = oAssyDef.RepresentationsManager Dim oViewRep As DesignViewRepresentation Set oViewRep = oMgr.ActiveDesignViewRepresentation oViewRep.ShowAll ' oViewRep.HideAll End Sub
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register