Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
MatthiasMinich
369 Views, 6 Replies

Change visibility of origin work plane at occurrence level

 

there is a difference when handling "user defined workplanes" and "origin work planes". It is not possible to change the visibility of a origin work plane only in the occurrence level. Modifying the "origin work plane proxie" always changes the parent document. whereas a "user defined work plane" can be shown only in a occurrence level. 

 

Please check the sample code below. Select a component (with a user defined work plane) in a assembly document. When the code is executed work planes (1-3) are shown in all occurrences, but the following work planes (4-...) are visible only in the selected occurrence, as desired.

 

Is there a work around to change the visibility of a origin work plane only at an occurrence?

 

I'm using Autodesk Inventor 2019

 

Best,

Matthias

 

Public Sub Test_WorkPlane_Visible()

    Dim oApp As Inventor.Application
    Set oApp = ThisApplication
    
    If oApp.ActiveDocumentType <> kAssemblyDocumentObject Then Exit Sub
    
    Dim oDoc As Inventor.AssemblyDocument
    Set oDoc = oApp.ActiveDocument
    
    
    Dim oOcc As Inventor.ComponentOccurrence
    Dim Item As Object
        
    For Each Item In oDoc.SelectSet
        If Item.Type = Inventor.kComponentOccurrenceObject Then
            Set oOcc = Item
            
            Dim i As Long
            For i = 1 To oOcc.Definition.WorkPlanes.Count
                
                Dim oWorkPlane As Inventor.WorkPlane
                Set oWorkPlane = oOcc.Definition.WorkPlanes.Item(i)
                
                Dim oWorkPlaneProxie As Inventor.WorkPlaneProxy
                Call oOcc.CreateGeometryProxy(oWorkPlane, oWorkPlaneProxie)
                        
                oWorkPlaneProxie.Visible = Not (oWorkPlaneProxie.Visible)
            Next i
        
        End If
    Next
    
End Sub

 

 

m_matthias_0-1678262156494.png