Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drawing view compnet visibility

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
695 Views, 3 Replies

Drawing view compnet visibility

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)

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

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

 

Message 3 of 4
Anonymous
in reply to: Anonymous

Thanks this much cleaner than what I ended up doing?

Message 4 of 4
Anonymous
in reply to: Anonymous

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?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report