<?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: Having trouble setting Sketch Color in a part in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284276#M105169</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;@ &amp;amp; @&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;Thank you both for your quick responses. That is exactly what I was looking for. FYI Curtis you are correct, if the sketch is empty then it throws an error but if you project the EdgeLoop on sketch creation then when you set the color it's fine. Thank you guys very much.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 00:39:08 GMT</pubDate>
    <dc:creator>neodd70</dc:creator>
    <dc:date>2020-01-30T00:39:08Z</dc:date>
    <item>
      <title>Having trouble setting Sketch Color in a part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284007#M105162</link>
      <description>&lt;P&gt;I have tried setting the sketch color of a part but I keep getting errors and I'm not sure what I'm doing wrong. I want to be able to have different sketches have different colors, this is in a part document not a drawing document. Everywhere I have looked talks about drawing documents but nothing about part documents.&lt;/P&gt;&lt;PRE&gt;Dim ThisDoc As PartDocument = ThisApplication.ActiveDocument
Dim CompDef As PartComponentDefinition = ThisDoc.ComponentDefinition
Dim oFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick Face")
Dim oSketch As PlanarSketch = CompDef.Sketches.Add(oFace)
oSketch.Color.SetColor(0, 255, 0)&lt;/PRE&gt;&lt;P&gt;Could someone point me in the right direction&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 22:01:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284007#M105162</guid>
      <dc:creator>neodd70</dc:creator>
      <dc:date>2020-01-29T22:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Having trouble setting Sketch Color in a part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284077#M105164</link>
      <description>&lt;P&gt;The problem here is that you try to change the color but by default a sketch does not have a color. therfor you need to give it a color. for example this will make your first skecth in your part red.&lt;/P&gt;&lt;PRE&gt;Dim doc As PartDocument = ThisDoc.Document
Dim red As Color = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
doc.ComponentDefinition.Sketches.Item(1).Color = red
' you need to update before the change get visable
doc.Update()&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 22:36:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284077#M105164</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2020-01-29T22:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Having trouble setting Sketch Color in a part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284119#M105166</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4447887"&gt;@neodd70&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition to JelteDeJong's observation, the other thing that I noticed, is that it seems that maybe the sketch needs to have at least one entity before the color can be applied? maybe?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was able to get this example to work, if I set the option to project the face into the sketch to &lt;FONT color="#0000FF"&gt;True&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim ThisDoc As PartDocument = ThisApplication.ActiveDocument
Dim CompDef As PartComponentDefinition = ThisDoc.ComponentDefinition
Dim oFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick Face")
Dim oSketch As Sketch = CompDef.Sketches.Add(oFace, &lt;FONT color="#0000FF"&gt;True&lt;/FONT&gt;)

Dim oColor As Inventor.Color
oColor = ThisApplication.TransientObjects.CreateColor(0, 255, 0)
oSketch.Color = oColor
ThisDoc.Update
&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 22:56:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284119#M105166</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2020-01-29T22:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Having trouble setting Sketch Color in a part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284276#M105169</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;@ &amp;amp; @&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;Thank you both for your quick responses. That is exactly what I was looking for. FYI Curtis you are correct, if the sketch is empty then it throws an error but if you project the EdgeLoop on sketch creation then when you set the color it's fine. Thank you guys very much.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 00:39:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/having-trouble-setting-sketch-color-in-a-part/m-p/9284276#M105169</guid>
      <dc:creator>neodd70</dc:creator>
      <dc:date>2020-01-30T00:39:08Z</dc:date>
    </item>
  </channel>
</rss>

