<?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: Faster way to change lines on view? in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/faster-way-to-change-lines-on-view/m-p/10793783#M42994</link>
    <description>&lt;P&gt;Thank you for the improved code, it seems to run marginally faster, but it still seems to run into the trouble of having to pick each segment so it still takes some time. I will look into the article that you linked to see if I can find anything that will help .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2021 15:20:06 GMT</pubDate>
    <dc:creator>s.mich</dc:creator>
    <dc:date>2021-12-01T15:20:06Z</dc:date>
    <item>
      <title>Faster way to change lines on view?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faster-way-to-change-lines-on-view/m-p/10791815#M42992</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have a rule that selects all the edges of a view and changes the layer to adjust the line thickness if the view is a shaded view. It works to do what I want it to do pretty well, but it takes a long time to run. Turning screen updating off doesn't seem to make it run much faster. Can anyone think of any improvements like being able to select all curves at the same time and batch layer change?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
    On Error Resume Next
'	ThisApplication.ScreenUpdating = False
	
	Dim oDoc As DrawingDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    oSheet = oDoc.ActiveSheet
    
    Dim olayers As LayersEnumerator
    olayers = oDoc.StylesManager.layers
    
    Dim VisXNarrow As Layer
    VisXNarrow = olayers.Item("Visible Extra Narrow (ANSI)")

    Dim oView As DrawingView
    For Each oSheet In oDoc.Sheets
		For Each oView In oSheet.DrawingViews

		        If oView.ViewStyle = kShadedDrawingViewStyle _
				Or oView.ViewStyle = kShadedHiddenLineDrawingViewStyle Then
'				Or oView.ViewStyle = kFromBaseDrawingViewStyle 
					
					Dim oCurves As DrawingCurvesEnumerator = oView.DrawingCurves()
					Dim oCurve As DrawingCurve

					For Each oCurve In oCurves
						For i = 1 To oCurve.Segments.Count
							oCurve.Segments.Item(i).Layer = VisXNarrow
						Next
					Next
				End If
	      Next
	Next

ThisApplication.ScreenUpdating = True

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 20:23:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faster-way-to-change-lines-on-view/m-p/10791815#M42992</guid>
      <dc:creator>s.mich</dc:creator>
      <dc:date>2021-11-30T20:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Faster way to change lines on view?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faster-way-to-change-lines-on-view/m-p/10791942#M42993</link>
      <description>&lt;P&gt;You might want to have a look at this article "&lt;A href="https://knowledge.autodesk.com/support/inventor/learn-explore/caas/simplecontent/content/improving-your-program-E2-80-99s-performance.html" target="_blank" rel="noopener"&gt;Improving Your Program’s Performance&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;you can also try this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ce5c95;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;oDoc&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #9d6bce;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN style="color: #ce5c95;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;oSheet&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;Sheet&lt;/SPAN&gt; = &lt;SPAN style="color: #db9652;"&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;ActiveSheet&lt;/SPAN&gt;
&lt;SPAN style="color: #ce5c95;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;olayers&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;LayersEnumerator&lt;/SPAN&gt; = &lt;SPAN style="color: #db9652;"&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;StylesManager&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Layers&lt;/SPAN&gt;
&lt;SPAN style="color: #ce5c95;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;VisXNarrow&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;Layer&lt;/SPAN&gt; = &lt;SPAN style="color: #db9652;"&gt;olayers&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #35b173;"&gt;"Visible Extra Narrow (ANSI)"&lt;/SPAN&gt;)

&lt;SPAN style="color: #ce5c95;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;segments&lt;/SPAN&gt; = &lt;SPAN style="color: #db9652;"&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Sheets&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Cast&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;Sheet&lt;/SPAN&gt;).
    &lt;SPAN style="color: #db9652;"&gt;SelectMany&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Function&lt;/SPAN&gt;(&lt;SPAN style="color: #db9652;"&gt;sheet&lt;/SPAN&gt;) &lt;SPAN style="color: #db9652;"&gt;sheet&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;DrawingViews&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Cast&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;DrawingView&lt;/SPAN&gt;)).
    &lt;SPAN style="color: #db9652;"&gt;Where&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Function&lt;/SPAN&gt;(&lt;SPAN style="color: #db9652;"&gt;view&lt;/SPAN&gt;)
                &lt;SPAN style="color: #ce5c95;"&gt;Return&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;view&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;ViewStyle&lt;/SPAN&gt; = &lt;SPAN style="color: #db9652;"&gt;DrawingViewStyleEnum&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;kShadedDrawingViewStyle&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;Or&lt;/SPAN&gt;
                &lt;SPAN style="color: #db9652;"&gt;view&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;ViewStyle&lt;/SPAN&gt; = &lt;SPAN style="color: #db9652;"&gt;DrawingViewStyleEnum&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;kShadedHiddenLineDrawingViewStyle&lt;/SPAN&gt;
            &lt;SPAN style="color: #ce5c95;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;Function&lt;/SPAN&gt;).
    &lt;SPAN style="color: #db9652;"&gt;SelectMany&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Function&lt;/SPAN&gt;(&lt;SPAN style="color: #db9652;"&gt;view&lt;/SPAN&gt;) &lt;SPAN style="color: #db9652;"&gt;view&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;DrawingCurves&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Cast&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;DrawingCurve&lt;/SPAN&gt;)).
    &lt;SPAN style="color: #db9652;"&gt;SelectMany&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Function&lt;/SPAN&gt;(&lt;SPAN style="color: #db9652;"&gt;curve&lt;/SPAN&gt;) &lt;SPAN style="color: #db9652;"&gt;curve&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Segments&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Cast&lt;/SPAN&gt;(&lt;SPAN style="color: #ce5c95;"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;DrawingCurveSegment&lt;/SPAN&gt;)).
    &lt;SPAN style="color: #db9652;"&gt;ToList&lt;/SPAN&gt;()

&lt;SPAN style="color: #ce5c95;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;trans&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;Transaction&lt;/SPAN&gt; = &lt;SPAN style="color: #9d6bce;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;TransactionManager&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;StartTransaction&lt;/SPAN&gt;(&lt;SPAN style="color: #db9652;"&gt;oDoc&lt;/SPAN&gt;, &lt;SPAN style="color: #35b173;"&gt;"Set layer"&lt;/SPAN&gt;)
&lt;SPAN style="color: #9d6bce;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;ScreenUpdating&lt;/SPAN&gt; = &lt;SPAN style="color: #ce5c95;"&gt;False&lt;/SPAN&gt;
&lt;SPAN style="color: #ce5c95;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;segment&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;DrawingCurveSegment&lt;/SPAN&gt; &lt;SPAN style="color: #ce5c95;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #db9652;"&gt;segments&lt;/SPAN&gt;
    &lt;SPAN style="color: #db9652;"&gt;segment&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;Layer&lt;/SPAN&gt; = &lt;SPAN style="color: #db9652;"&gt;VisXNarrow&lt;/SPAN&gt;
&lt;SPAN style="color: #ce5c95;"&gt;Next&lt;/SPAN&gt;
&lt;SPAN style="color: #9d6bce;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;ScreenUpdating&lt;/SPAN&gt; = &lt;SPAN style="color: #ce5c95;"&gt;True&lt;/SPAN&gt;
&lt;SPAN style="color: #db9652;"&gt;trans&lt;/SPAN&gt;.&lt;SPAN style="color: #db9652;"&gt;End&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 21:23:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faster-way-to-change-lines-on-view/m-p/10791942#M42993</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2021-11-30T21:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Faster way to change lines on view?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faster-way-to-change-lines-on-view/m-p/10793783#M42994</link>
      <description>&lt;P&gt;Thank you for the improved code, it seems to run marginally faster, but it still seems to run into the trouble of having to pick each segment so it still takes some time. I will look into the article that you linked to see if I can find anything that will help .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 15:20:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faster-way-to-change-lines-on-view/m-p/10793783#M42994</guid>
      <dc:creator>s.mich</dc:creator>
      <dc:date>2021-12-01T15:20:06Z</dc:date>
    </item>
  </channel>
</rss>

