Hi
I am using this code to turn visibility of componets off in IDw file can anyone tell me what I need top turn visibility of a componet of in a subassembly.
'oDrawingDocument = ThisApplication.ActiveDocument
'Get the first view
'Dim oView As Inventor.DrawingView
'oView = oDrawingDocument.ActiveSheet.DrawingViews.Item(2)
'Get the assembly document referenced by the view
'Dim oAssemblyDocument As Inventor.AssemblyDocument
'oAssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
'Get the Third component occurrence of the assembly document
'Dim oThirdOccurrence As Inventor.ComponentOccurrence
'oThirdOccurrence = oAssemblyDocument.ComponentDefinition.Occurrences.Item(3)
'Turn off visibility of the Third occurrence
'oView.SetVisibility (oThirdOccurrence, True)
Solved! Go to Solution.
Like this?
Public Sub TurnOffVisibilitySubassembly() Dim oDrawingDocument As DrawingDocument Set oDrawingDocument = ThisApplication.ActiveDocument Dim oView As Inventor.DrawingView Set oView = oDrawingDocument.ActiveSheet.DrawingViews.Item(1) Dim oAssemblyDocument As Inventor.AssemblyDocument Set oAssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument 'Get the Third component occurrence of the assembly document Dim oSubOcc As Inventor.ComponentOccurrence Set oSubOcc = oAssemblyDocument.ComponentDefinition.Occurrences.Item(3).SubOccurrences.Item(1) 'Turn off visibility of the suboccurrence Call oView.SetVisibility(oSubOcc, False) End Sub
How would you use this but instead of a specific assembly, if you could control what is turn off via a parameter within each part?