<?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: Make feature sketch invisible in an assembly in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12038422#M22486</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12591383"&gt;@Hubert_Los&lt;/a&gt;&amp;nbsp;.&amp;nbsp;I finally understood you. Thanks for the video explaining what you need it really helped. Here is the code that determines the visibility of all proxy skeaths and makes them invisible:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Private Sub Main()
	Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
	Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oDoc, "SetVisibleSketch")
	Call SetVisibleSketch(oDoc.ComponentDefinition.Occurrences)
	oTrans.End()
End Sub

Private Function SetVisibleSketch(oOccs As ComponentOccurrences, Optional bVisible As Boolean = False)
	For Each oOcc As ComponentOccurrence In oOccs
		If oOcc.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject Then
			On Error Resume Next
			Dim oOccDef As PartComponentDefinition = oOcc.Definition
			For Each oSketch As PlanarSketch In oOccDef.Sketches
				Dim oSketchProxy As PlanarSketchProxy : oOcc.CreateGeometryProxy(oSketch, oSketchProxy)
				If oSketchProxy.Visible Then oSketchProxy.Visible = False
			Next
		Else If oOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
			If oOcc.SubOccurrences.Count &amp;gt; 0 Then
				Call SetVisibleSketch(oOcc.SubOccurrences)
			End If
		End If
	Next
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2023 08:53:42 GMT</pubDate>
    <dc:creator>Andrii_Humeniuk</dc:creator>
    <dc:date>2023-06-16T08:53:42Z</dc:date>
    <item>
      <title>Make feature sketch invisible in an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029599#M22481</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;How to make invisible all the feature sketches that are make visible in the assembly?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hubert_Los_1-1686639141147.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1226726i8C56BF1A9E783882/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hubert_Los_1-1686639141147.png" alt="Hubert_Los_1-1686639141147.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 06:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029599#M22481</guid>
      <dc:creator>Hubert_Los</dc:creator>
      <dc:date>2023-06-13T06:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Make feature sketch invisible in an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029620#M22482</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12591383"&gt;@Hubert_Los&lt;/a&gt;&amp;nbsp;.&amp;nbsp;Try this iLogic code. It makes all sketches in all components of the main assembly invisible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Private Sub Main()
	Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
	Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oDoc, "SetVisibleSketch")
	For Each oRefDoc As Document In oDoc.AllReferencedDocuments
		If TypeOf oRefDoc Is PartDocument And oRefDoc.IsModifiable Then
			Dim oPDoc As PartDocument = oRefDoc
			Call SetVisibleSketch(oPDoc.ComponentDefinition.Sketches)
		End If
	Next
	oTrans.End()
End Sub

Private Function SetVisibleSketch(oSkets As PlanarSketches, Optional bVisible As Boolean = False)
	For i As Integer = 1 To oSkets.Count
		If oSkets.Item(i).Visible Then oSkets.Item(i).Visible = bVisible
	Next
End Function&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Jun 2023 07:07:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029620#M22482</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-06-13T07:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Make feature sketch invisible in an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029880#M22483</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Unfortunately your code only works on "shered skeches" I have a different situation. I enable sketch editing from the assembly level and this sketch is not share.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 09:26:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029880#M22483</guid>
      <dc:creator>Hubert_Los</dc:creator>
      <dc:date>2023-06-13T09:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Make feature sketch invisible in an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029977#M22484</link>
      <description>&lt;P&gt;Not sure I understood you correctly, but made the changes to the code. Now the visibility of sketches is turned off in the main assembly and in subassemblies and in details. The code also includes a check for the ability to modify documents.&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Private Sub Main()
	Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
	Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oDoc, "SetVisibleSketch")
	If oDoc.IsModifiable Then Call SetVisibleSketch(oDoc.ComponentDefinition.Sketches)
	For Each oRefDoc As Document In oDoc.AllReferencedDocuments
		If oRefDoc.IsModifiable Then
			Call SetVisibleSketch(oRefDoc.ComponentDefinition.Sketches)
		End If
	Next
	oTrans.End()
End Sub

Private Function SetVisibleSketch(oSkets As PlanarSketches, Optional bVisible As Boolean = False)
	For i As Integer = 1 To oSkets.Count
		On Error Resume Next
		If oSkets.Item(i).Visible Then oSkets.Item(i).Visible = bVisible
	Next i
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 10:39:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12029977#M22484</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-06-13T10:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Make feature sketch invisible in an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12038221#M22485</link>
      <description>&lt;P&gt;Sorry, but it doesn't work.&amp;nbsp;I'm sending a video of what sketch I mean&lt;/P&gt;&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6329531222112w1600h528r171" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6329531222112" data-account="6057940548001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6057940548001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6329531222112w1600h528r171');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://forums.autodesk.com/t5/video/gallerypage/video-id/6329531222112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 07:09:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12038221#M22485</guid>
      <dc:creator>Hubert_Los</dc:creator>
      <dc:date>2023-06-16T07:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Make feature sketch invisible in an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12038422#M22486</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12591383"&gt;@Hubert_Los&lt;/a&gt;&amp;nbsp;.&amp;nbsp;I finally understood you. Thanks for the video explaining what you need it really helped. Here is the code that determines the visibility of all proxy skeaths and makes them invisible:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Private Sub Main()
	Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
	Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oDoc, "SetVisibleSketch")
	Call SetVisibleSketch(oDoc.ComponentDefinition.Occurrences)
	oTrans.End()
End Sub

Private Function SetVisibleSketch(oOccs As ComponentOccurrences, Optional bVisible As Boolean = False)
	For Each oOcc As ComponentOccurrence In oOccs
		If oOcc.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject Then
			On Error Resume Next
			Dim oOccDef As PartComponentDefinition = oOcc.Definition
			For Each oSketch As PlanarSketch In oOccDef.Sketches
				Dim oSketchProxy As PlanarSketchProxy : oOcc.CreateGeometryProxy(oSketch, oSketchProxy)
				If oSketchProxy.Visible Then oSketchProxy.Visible = False
			Next
		Else If oOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
			If oOcc.SubOccurrences.Count &amp;gt; 0 Then
				Call SetVisibleSketch(oOcc.SubOccurrences)
			End If
		End If
	Next
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 08:53:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12038422#M22486</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-06-16T08:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Make feature sketch invisible in an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12038465#M22487</link>
      <description>&lt;P&gt;Now it works, thank you&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 09:15:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-feature-sketch-invisible-in-an-assembly/m-p/12038465#M22487</guid>
      <dc:creator>Hubert_Los</dc:creator>
      <dc:date>2023-06-16T09:15:34Z</dc:date>
    </item>
  </channel>
</rss>

