<?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: How to turn a sketch off in a subassemly while in a upper assembly in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656201#M12140</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&amp;nbsp;Your mind has no comparison here among mortals. In my country we say "No tiene Parangón" Big hug, my best wishes for you and your career, I hope to continue learning from you as time goes by!&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 13:15:02 GMT</pubDate>
    <dc:creator>Sergio.D.Suárez</dc:creator>
    <dc:date>2024-03-21T13:15:02Z</dc:date>
    <item>
      <title>How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12654430#M12136</link>
      <description>&lt;P&gt;How to use ilogic in a upper level assembly to turn the visibility of a sketch in a subassembly off. Here is the picture of the browser in the upper level assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="X2RESTON_0-1710965678745.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1339615iEA5A644972ED30E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="X2RESTON_0-1710965678745.png" alt="X2RESTON_0-1710965678745.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 20:15:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12654430#M12136</guid>
      <dc:creator>X2RESTON</dc:creator>
      <dc:date>2024-03-20T20:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656177#M12137</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good morning, try the following code. Make sure the name of the subassembly detailed in red is correct. Also make sure that the name of the sketch is correct. I hope this helps with your work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;AssyDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;AssyCD&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;AssyDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oCC&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;AssyCD&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oCC&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt; = &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;"PHY-STA-CY24-000000117:1"&lt;/FONT&gt;&lt;/STRONG&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;SubAssyDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;oCC&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;SubAssyCD&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;SubAssyDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
		&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oSketch&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PlanarSketch&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;SubAssyCD&lt;/SPAN&gt;.&lt;SPAN&gt;Sketches&lt;/SPAN&gt;
			&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oSketch&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt; = &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;"Sketch 1"&lt;/FONT&gt;&lt;/STRONG&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;oSketch&lt;/SPAN&gt;.&lt;SPAN&gt;Visible&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
		&lt;SPAN&gt;Next&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 13:07:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656177#M12137</guid>
      <dc:creator>Sergio.D.Suárez</dc:creator>
      <dc:date>2024-03-21T13:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656180#M12138</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14716212"&gt;@X2RESTON&lt;/a&gt;.&amp;nbsp; There are multiple ways to do that by code.&amp;nbsp; The best way would be if you already had a DVR (&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-DesignViewRepresentation" target="_blank" rel="noopener"&gt;DesignViewRepresentation&lt;/A&gt;) defined within that sub assembly in which the visibility of that sketch was already turned off, then set the component representing that sub assembly to that DVR (using the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=ComponentOccurrence_SetDesignViewRepresentation" target="_blank" rel="noopener"&gt;ComponentOccurrence.SetDesignViewRepresentation&lt;/A&gt;&amp;nbsp;method), and I usually prefer to set the 'Associative' setting to True, to keep it up to date when the model changes.&amp;nbsp; If that sub assembly only has the one "[Primary]" DVR, then the 'associative' option will not be available.&amp;nbsp; If there are some custom DVR's in the sub assembly, then you will need to make sure that when you change the visibility of that sketch, it is recorded by the DVR that the component representing that sub assembly is set to.&amp;nbsp; After any changes, update the main assembly to see the results of the changes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one possible route you could try, but it is very specific due to hardcoding the name of the component and the name of the sketch in the code, and does not even consider any DVR settings yet.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oADoc As AssemblyDocument = ThisDoc.Document
	Dim oOcc As ComponentOccurrence = oADoc.ComponentDefinition.Occurrences.ItemByName("PHY-STA-CY24-000000117:1")
	Dim oSketches As PlanarSketches = oOcc.Definition.Sketches
	Dim oSketch As PlanarSketch = oSketches.Item("Sketch 1")
	oSketch.Visible = False
	oADoc.Update2(True)
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 13:08:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656180#M12138</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-03-21T13:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656183#M12139</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt; Great minds think alike.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 13:09:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656183#M12139</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-03-21T13:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656201#M12140</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&amp;nbsp;Your mind has no comparison here among mortals. In my country we say "No tiene Parangón" Big hug, my best wishes for you and your career, I hope to continue learning from you as time goes by!&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 13:15:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656201#M12140</guid>
      <dc:creator>Sergio.D.Suárez</dc:creator>
      <dc:date>2024-03-21T13:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656857#M12141</link>
      <description>&lt;P&gt;This works great at turning the sketch 1 off in the subassembly. The only problem is that in the upper assembly it does not show that it needs updates or anything. In other words, The sketch is still showing on in the upper assembly.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 16:57:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656857#M12141</guid>
      <dc:creator>X2RESTON</dc:creator>
      <dc:date>2024-03-21T16:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656931#M12142</link>
      <description>&lt;P&gt;This may be because the component in the assembly representing the sub assembly is either set to a different DVR than the one that the edit was made within the referenced document, or if it is set to the same DVR, it may not have its 'associative' setting turned on.&amp;nbsp; What DVR is that component set to?&amp;nbsp; To check this quickly, just select the component, right-click your mouse, and select Representations within the right-click menu.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 17:22:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12656931#M12142</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-03-21T17:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn a sketch off in a subassemly while in a upper assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12657072#M12143</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14716212"&gt;@X2RESTON&lt;/a&gt;.&amp;nbsp; Here is another version of the code I posted above that may work better for you.&amp;nbsp; It attempts to check which DVR the component is currently set to, then attempts to make sure the DVR by that same name is active in the referenced document before it makes the edits, so that they will be recorded by that DVR.&amp;nbsp; Then attempts to set the component to that same DVR again, but this time as 'associative', to help keep the component visually updated to changes in the referenced model.&amp;nbsp; Then updates the main assembly.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oADoc As AssemblyDocument = ThisDoc.Document
	Dim oOcc As ComponentOccurrence = oADoc.ComponentDefinition.Occurrences.ItemByName("PHY-STA-CY24-000000117:1")
	Dim sOccDVRName As String = oOcc.ActiveDesignViewRepresentation 'possibly hidden, ReadOnly property
	Dim bIsAssoc As Boolean = oOcc.IsAssociativeToDesignViewRepresentation
	Dim oCD As ComponentDefinition = oOcc.Definition
	Dim oRepsMgr As RepresentationsManager = oCD.RepresentationsManager
	oOcc.Edit
	If oRepsMgr.ActiveDesignViewRepresentation.Name &amp;lt;&amp;gt; sOccDVRName Then
		oRepsMgr.DesignViewRepresentations.Item(sOccDVRName).Activate
	End If
	Dim oSketches As PlanarSketches = oOcc.Definition.Sketches
	Dim oSketch As PlanarSketch = oSketches.Item("Sketch 1")
	oSketch.Visible = False
	oOcc.ExitEdit(ExitTypeEnum.kExitToPrevious)
	Try : oOcc.SetDesignViewRepresentation(sOccDVRName, , True) : Catch : End Try
	oADoc.Update2(True)
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:36:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-turn-a-sketch-off-in-a-subassemly-while-in-a-upper/m-p/12657072#M12143</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-03-21T18:36:41Z</dc:date>
    </item>
  </channel>
</rss>

