Show Model Sketches and Referenceplanes in Drawingview

How to show Model Sketches and Referenceplanes in a Drawingview by API?

 

Kind Regards Marthijn

2 REPLIES

Re: Show Model Sketches and Referenceplanes in Drawingview

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

If you want to show all reference planes and model sketches in a drawing view, you have to make their corresponding model members visible.

The following code shows all sketches and reference planes in all drawing views on the active sheet:

    '----------------------------------------------------------------------
    ' DFT: Show all sketches and reference planes in all drawing views
    '----------------------------------------------------------------------
    Dim objDoc As SolidEdgeDraft.DraftDocument = objApp.ActiveDocument
    Dim objSheet As SolidEdgeDraft.Sheet = objDoc.ActiveSheet
    For Each objDrawView As DrawingView In objSheet.DrawingViews
      ' As the drawing was generated from a Part document, only one ModelMember for the document exists
      Dim objDocMember As ModelMember = objDrawView.ModelMembers.Item(1)
      For Each objMember As ModelMember In objDocMember.ModelMembers
        If objMember.ComponentType = ModelMemberComponentTypeConstants.seReferencePlaneMemberType OrElse _
           objMember.ComponentType = ModelMemberComponentTypeConstants.seSketchMemberType Then
          objMember.DisplayType = ModelMemberDisplayTypeConstants.seShowPart
        End If
      Next
      objDrawView.Update()
    Next

Re: Show Model Sketches and Referenceplanes in Drawingview

Thanks for your help Martin Bernard!