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

Turn off model sketches in drawing

Hello everyone, I got the following problem:

 

I have a drawing with 1 view of a part.

I get the model sketches of that part in a drawing view

 

If you right click that sketch you can choose "Include" and "Visible"

 

Now I made the following code in ilogic:

 

Sub Main()
    Dim oDoc As DrawingDocument = ThisDoc.Document
    Dim oSheet As Sheet = oDoc.ActiveSheet
    Dim oNode As BrowserNode = oDoc.BrowserPanes("Model").GetBrowserNodeFromObject(oSheet.DrawingViews.Item(1))

    Call recurseNodes(oNode)
End Sub

Sub recurseNodes(node As BrowserNode)
     
    Dim bn As BrowserNode
    
    For Each bn In node.BrowserNodes

            If TypeName(bn.NativeObject) = "PlanarSketch" Then
                bn.Visible = False
                MsgBox(bn.Visible)
                Dim oSketch As PlanarSketch = bn.NativeObject
                oSketch.Visible = False
                MsgBox(oSketch.Visible)
                Dim oProxy As PlanarSketchProxy = TryCast(oSketch, PlanarSketchProxy)

                If oProxy Is Nothing Then MsgBox("fail")

            End If
            If Not TypeName(bn.NativeObject) = "DrawingView" Then
                Call recurseNodes(bn)
            Else
                Continue For
            End If
    Next
End Sub

Now the messageboxes say that sketches are turned off,  but in truth nothing happens, sketches remain on.

 

What am I doing wrong?

 

Thanks in advance,

 

Arnold