<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Turn off model sketches in drawing in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312331#M74344</link>
    <description>&lt;P&gt;Looking a little deeper,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-D273D9C3-C24F-4CDD-B571-F2C0B5F7A5B3" target="_blank"&gt;http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-D273D9C3-C24F-4CDD-B571-F2C0B5F7A5B3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;reveals that .SetIncludeStatus and .SetVisibility are likely much better bets.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Aug 2017 20:47:15 GMT</pubDate>
    <dc:creator>MechMachineMan</dc:creator>
    <dc:date>2017-08-18T20:47:15Z</dc:date>
    <item>
      <title>Turn off model sketches in drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312050#M74341</link>
      <description>&lt;P&gt;Hello everyone, I got the following problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a drawing with 1 view of a part.&lt;/P&gt;&lt;P&gt;I get the model sketches of that part in a drawing view&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you right click that sketch you can choose "Include" and "Visible"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I made the following code in ilogic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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&lt;/PRE&gt;&lt;P&gt;Now the messageboxes say that sketches are turned off,&amp;nbsp; but in truth nothing happens, sketches remain on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Arnold&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 18:48:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312050#M74341</guid>
      <dc:creator>Cadkunde.nl</dc:creator>
      <dc:date>2017-08-18T18:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off model sketches in drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312327#M74343</link>
      <description>&lt;P&gt;Try this. If it doesn't work, try uncommenting the lines and trying it with the command I have in there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;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
    'Dim oCommandMgr As CommandManager
    'oCommandMgr = ThisApplication.CommandManager
    'Dim oControlDef1 As ControlDefinition
    For Each bn In node.BrowserNodes

            If TypeName(bn.NativeObject) = "PlanarSketch" Then
                &lt;STRONG&gt;bn.EnsureVisible = true&lt;/STRONG&gt;
                &lt;STRONG&gt;bn.Visible = True&lt;/STRONG&gt;
                'bn.DoSelect
                'oControlDef1 = oCommandMgr.ControlDefinitions.Item("DrawingEntityVisibilityCtxCmd")
            'oControlDef1.Execute
                    
                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&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2017 20:44:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312327#M74343</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-08-18T20:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off model sketches in drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312331#M74344</link>
      <description>&lt;P&gt;Looking a little deeper,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-D273D9C3-C24F-4CDD-B571-F2C0B5F7A5B3" target="_blank"&gt;http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-D273D9C3-C24F-4CDD-B571-F2C0B5F7A5B3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;reveals that .SetIncludeStatus and .SetVisibility are likely much better bets.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 20:47:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312331#M74344</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-08-18T20:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Turn off model sketches in drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312369#M74345</link>
      <description>&lt;P&gt;Yes, I got it working now. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oProxy As PlanarSketchProxy = TryCast(oSketch, PlanarSketchProxy)
 oDoc.Sheets(1).DrawingViews(1).SetVisibility(oSketch, False)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I did bn.visible it actually turned the sketch of in the part&lt;/P&gt;&lt;P&gt;I tried bn.BrowserNodeDefinition.Visible but that completely removed the node from the browser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was fooled that the Include and Visibility were properties of the browsernode rather than the drawingview.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 21:06:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/turn-off-model-sketches-in-drawing/m-p/7312369#M74345</guid>
      <dc:creator>Cadkunde.nl</dc:creator>
      <dc:date>2017-08-18T21:06:22Z</dc:date>
    </item>
  </channel>
</rss>

