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: 

Disable workplaneproxy visibility

2 REPLIES 2
Reply
Message 1 of 3
Hubert_Los
175 Views, 2 Replies

Disable workplaneproxy visibility

Hello,

I have code to disable the visibility of all workfeatures. But in the main assembler I can still see workplanes. This type is workplaceproxy, how can I disable the visibility of these workplanes?

Sub OffFeatures2()
    Dim oAssyDoc As AssemblyDocument
    Set oAssyDoc = ThisApplication.ActiveDocument
    
    Call offAllFeature(oAssyDoc, False)

    For Each oDoc In oAssyDoc.AllReferencedDocuments
        Call offAllFeature(oDoc, False)
    Next
    
    Dim oCCs As ComponentOccurrences
    Set oCCs = oAssyDoc.ComponentDefinition.Occurrences

End Sub

Sub offAllFeature(oDoc As Document, wfBoolean As Boolean)
    
        For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
            oWorkPlane.Visible = wfBoolean
        Next

        For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
            oWorkAxis.Visible = wfBoolean
        Next

        For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
            oWorkPoint.Visible = wfBoolean
        Next

        For Each oSketch In oDoc.ComponentDefinition.Sketches
            oSketch.Visible = wfBoolean
        Next
        
        If Not oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
            For Each oSketch3D In oDoc.ComponentDefinition.Sketches3D
                oSketch3D.Visible = wfBoolean
            Next
        End If

End Sub
Tags (3)
2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: Hubert_Los

Hi @Hubert_Los.  This can be complicated to explain.  For one thing, I do not see any code included to update the main assembly after making the changes to all the referenced documents.  Also, if any of the referenced documents are ReadOnly, such as from the ContentCenter, or library files, then the changes will not effect them, and may throw errors when you try to make those changes to them.  That may be needed before changes to those referenced documents will be seen in the main assembly.  Next, since visibility is recorded in DVRs (DVRs = DesignViewRepresentations & DVR = DesignViewRepresentation), you would need to make sure that each component is set to the DVR in which those changes were made, so that the component looks like that while in the assembly.  Then, if that component is within a sub assembly, then that sub assembly also has DVRs, and one of them recorded how you set the DVR of each of its components.  Then the component representing that sub assembly would need to be set to the DVR where those changes were made.  If every component at every level only had its one original DVR, and no others, then this complex process may not be needed.  Also, if a component is set to a custom DVR, then there is an additional settings about whether that settings is 'associative' or not' that needs to be kept in mind.  If every component that is set to a specific DVR has that property set to True, then its appearance should stay up-to-date with what its referenced model looks like when that DVR in it is active.  If that property is False, then the appearance of the component may not stay up-to-date with the model it is referencing.  The DVR's should normally be set-up from bottom to top (from the lowest / deepest part, then its parent sub assemblies, then the main assembly).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3
Hubert_Los
in reply to: Hubert_Los

@WCrihfield 
It sounds complex. I'll have to postpone this task until later. Thank you for the explanation.

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

Post to forums  

Autodesk Design & Make Report