Automatically show reference planes in drawing views

Automatically show reference planes in drawing views

design
Contributor Contributor
742 Views
3 Replies
Message 1 of 4

Automatically show reference planes in drawing views

design
Contributor
Contributor

I would like every drawing view I create to show XY, YZ, ZX planes where appropriate by default without having to manually add them.

Currently I have to RMB>Include the plane on every single view.

 

0 Likes
Accepted solutions (1)
743 Views
3 Replies
Replies (3)
Message 2 of 4

johnsonshiue
Community Manager
Community Manager

Hi! For manual workflows, I believe you do need to right-click on the origin planes in the drawing browser -> check Include. There should be a way to do it automatically via an iLogic rule.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 3 of 4

dgreatice
Collaborator
Collaborator
Accepted solution

Hi,

 

Try this code, put into VBA macro. not in iLogic rule.

 

Public Sub ViewOriginPlane()
    Dim oDwgDoc As DrawingDocument
    Set oDwgDoc = ThisApplication.ActiveDocument
   
    Dim oSht As Sheet
    Set oSht = oDwgDoc.ActiveSheet
   
    Dim oDwgView As DrawingView
    Set oDwgView = ThisApplication.CommandManager.Pick(kDrawingViewFilter, "Select view to show the origin plane")
    Dim oWP As WorkPlane
   
    If oDwgView.ReferencedDocumentDescriptor.ReferencedDocumentType = kPartDocumentObject Then
        Dim oPartDoc As PartDocument
        Set oPartDoc = oDwgView.ReferencedDocumentDescriptor.ReferencedDocument
       
        Dim oPartCompDef As PartComponentDefinition
        Set oPartCompDef = oPartDoc.ComponentDefinition
       
        For Each oWP In oPartCompDef.WorkPlanes
            oWP.AutoResize = True
            On Error Resume Next
            Call oDwgView.SetIncludeStatus(oWP, True)
        Next
    Else
        Dim oAssyDoc As AssemblyDocument
        Set oAssyDoc = oDwgView.ReferencedDocumentDescriptor.ReferencedDocument
       
        Dim oAssyCompDef As AssemblyComponentDefinition
        Set oAssyCompDef = oAssyDoc.ComponentDefinition
       
        For Each oWP In oAssyCompDef.WorkPlanes
            oWP.AutoResize = True
            On Error Resume Next
            Call oDwgView.SetIncludeStatus(oWP, True)
        Next
    End If
   
End Sub

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 4 of 4

design
Contributor
Contributor

Thank you so much for sharing your code!

0 Likes