<?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 assigning surface curves to new layer in idw in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11853311#M150635</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i found this thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/assign-surface-body-to-layer/td-p/7794576" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/assign-surface-body-to-layer/td-p/7794576&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code works but i'd like to adapt it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of phantom i need to be a continuous line in magenta.&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have the choice to either:&lt;/P&gt;&lt;P&gt;only change the colour or assign the surface line to a layer in magenta colour.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i see i can change the number behind the&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;StylesManager&lt;/SPAN&gt;.&lt;SPAN&gt;Layers&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;but i have no idea to which layer the number corresponds to.&lt;/P&gt;&lt;P&gt;is there a list?&lt;/P&gt;&lt;P&gt;i'm considering creating a layer called "Etched Lines" with continuous lines in Magenta (R255, G0, B255)&lt;/P&gt;&lt;P&gt;could the ilogic gurus do their magic please?&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 12:27:46 GMT</pubDate>
    <dc:creator>romu51</dc:creator>
    <dc:date>2023-03-28T12:27:46Z</dc:date>
    <item>
      <title>assigning surface curves to new layer in idw</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11853311#M150635</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i found this thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/assign-surface-body-to-layer/td-p/7794576" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/assign-surface-body-to-layer/td-p/7794576&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code works but i'd like to adapt it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of phantom i need to be a continuous line in magenta.&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have the choice to either:&lt;/P&gt;&lt;P&gt;only change the colour or assign the surface line to a layer in magenta colour.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i see i can change the number behind the&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;StylesManager&lt;/SPAN&gt;.&lt;SPAN&gt;Layers&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;but i have no idea to which layer the number corresponds to.&lt;/P&gt;&lt;P&gt;is there a list?&lt;/P&gt;&lt;P&gt;i'm considering creating a layer called "Etched Lines" with continuous lines in Magenta (R255, G0, B255)&lt;/P&gt;&lt;P&gt;could the ilogic gurus do their magic please?&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 12:27:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11853311#M150635</guid>
      <dc:creator>romu51</dc:creator>
      <dc:date>2023-03-28T12:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: assigning surface curves to new layer in idw</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11854363#M150664</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/111462"&gt;@romu51&lt;/a&gt;.&amp;nbsp; The layers can be customized, so the 'Index' number way of accessing them is not a very good way if you want a specific one.&amp;nbsp; You can specify the internal name of the layer instead of its index number there if you want.&amp;nbsp; What is the scope of your request?&amp;nbsp; (Do you want the code to effect every view on every sheet of a multi-sheet drawing ; or do you only want to work with one specific view, or somewhere between?&amp;nbsp; Please specify.)&amp;nbsp; Would you prefer to simply pick the view you want the code to work on manually, instead of trying to find it by code?&amp;nbsp; Do you want it to effect all geometry in the view from every possible WorkSurface type object in the model, or just one specific one?&amp;nbsp; The Layer route is generally better, because you can change how a Layer looks later in the Layers dialog if you want, outside of the code, without needing to change the code itself.&amp;nbsp; There is a quicker way though.&amp;nbsp; You can collect all drawing curve segments into an ObjectCollection, then use the Sheet.ChangeLayer() method to change them all to a specified layer at one time, instead of individually.&amp;nbsp; Less processing that way.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:04:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11854363#M150664</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-03-28T19:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: assigning surface curves to new layer in idw</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11854427#M150668</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thank you for the reply.&lt;/P&gt;&lt;P&gt;I understand the "index" is made of "volotile" references where every style library makes it different.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking at creating a new layer to display what i want but my knowledge of coding is limited.&lt;/P&gt;&lt;P&gt;The scope would be to have the code to effect one view only but i cant guaranty it would always be the same (ie front). It would be nice to be prompted to choose which view it would be applicable to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;we don't use surfaces much so i'm happy to display all surface curves and have them all in one layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So your suggestion to collect all curves and have them all on that new layer works for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd need to code to activate the "Include Surface Bodies" tick box as this works well to display the surface curves.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="romu51_0-1680031981181.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1194864iB199490E741F4C6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="romu51_0-1680031981181.png" alt="romu51_0-1680031981181.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:37:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11854427#M150668</guid>
      <dc:creator>romu51</dc:creator>
      <dc:date>2023-03-28T19:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: assigning surface curves to new layer in idw</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11856044#M150686</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/111462"&gt;@romu51&lt;/a&gt;.&amp;nbsp; Below is an iLogic rule you can try for that task.&amp;nbsp; I have not tested it yet myself, so I am not 100% sure if it will work yet, because WorkSurface is not one of the object types listed that we can use as input into the DrawingView.DrawingCurves property to get its curves.&amp;nbsp; If this fails, we may have to go an additional step (or few) deeper by exploring into the WorkSurface.SurfaceBodies property, if this is even possible.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a Drawing View.")
If IsNothing(oObj) OrElse (TypeOf oObj Is DrawingView = False) Then Exit Sub
Dim oView As DrawingView = oObj
oView.IncludeSurfaceBodies = True
Dim oSheet As Inventor.Sheet = oView.Parent
oModelType = oView.ReferencedDocumentDescriptor.ReferencedDocumentType
If oModelType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("The view must be of a Part, not an Assembly, because only Parts have WorkSurfaces.",,"")
	Exit Sub
End If
Dim oViewPDoc As PartDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oWSs As WorkSurfaces = oViewPDoc.ComponentDefinition.WorkSurfaces
If oWSs.Count = 0 Then
	MsgBox("There were no WorkSurfaces found in the Part in the selected view.",,"")
	Exit Sub
End If
Dim oObjCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oWS As WorkSurface In oWSs
	Dim oDCurves As DrawingCurvesEnumerator = Nothing
	Try : oDCurves = oView.DrawingCurves(oWS) : Catch : End Try
	If IsNothing(oDCurves) OrElse oDCurves.Count = 0 Then Continue For 'skip to next oWS
	For Each oDC As DrawingCurve In oDCurves
		Dim oDCSs As DrawingCurveSegments = oDC.Segments
		For Each oDCS As DrawingCurveSegment In oDCSs
			oObjCol.Add(oDCS)
		Next
	Next
Next
If oObjCol.Count = 0 Then Exit Sub
Dim oDDoc As DrawingDocument = oSheet.Parent
Dim oLayer As Inventor.Layer = Nothing
Dim oLayerCreated As Boolean = False
Try
	oLayer = oDDoc.StylesManager.Layers.Item("WorkSurface Curves")
Catch
	oLayer = oDDoc.StylesManager.Layers.Item(1).Copy("WorkSurface Curves")
	oLayerCreated = True
End Try
If oLayerCreated Then
	oLayer.Color = ThisApplication.TransientObjects.CreateColor(255, 0, 0) 'Pure Red
	oLayer.LineType = LineTypeEnum.kContinuousLineType
	'oLayer.LineWeight = .01 'in centimeters
	oLayer.Plot = True
	oLayer.Visible = True
	'oLayer.SaveToGlobal
End If
oSheet.ChangeLayer(oObjCol, oLayer)&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;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:00:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11856044#M150686</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-03-29T12:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: assigning surface curves to new layer in idw</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11856076#M150687</link>
      <description>&lt;P&gt;My hat's off to you!&lt;/P&gt;&lt;P&gt;Just perfect! Many thanks!&lt;/P&gt;&lt;P&gt;now added to my template!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:13:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/assigning-surface-curves-to-new-layer-in-idw/m-p/11856076#M150687</guid>
      <dc:creator>romu51</dc:creator>
      <dc:date>2023-03-29T12:13:00Z</dc:date>
    </item>
  </channel>
</rss>

