Community
Hello together,
how could I use these functions "AssemblyAllVisibleDesignViewCmd" and "AssemblyAllInvisibleDesignViewCmd " to show and hide all parts?
Thank you
Georg
Solved! Go to Solution.
Solved by Vladimir.Ananyev. 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("AssemblyAllVisibleDesignViewCmd") oControlDef.Execute End Sub Pub Vis_2() Dim oControlDef As ControlDefinition Set oControlDef = ThisApplication.CommandManager _ .ControlDefinitions.Item("AssemblyAllInvisibleDesignViewCmd") 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