<?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: Use iLogic to assign a color to one part face in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270508#M105102</link>
    <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It occurred to me after reading your second reply, that if you're just wanting to set the face to a known local color, then you can use a much simpler rule similar to&amp;nbsp;what mcgyvr&amp;nbsp; suggested, here's and example of that too.&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" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'set this rule to watch this parameter
oTrigger = FaceIsColored

Dim oDoc As PartDocument 
oDoc = ThisApplication.ActiveDocument

Dim oEntities As Object 
oEntities = iLogicVb.Automation.GetNamedEntities(oDoc)

'get the named face
Dim oFace As Face 
oFace = oEntities.FindEntity("Target Face")

'set the color if paramter is true
If Parameter("FaceIsColored") = True Then
	oFace.Appearance = oDoc.Assets.Item("Dark Green")
Else
	oFace.Appearance = oDoc.ActiveAppearance
End If&amp;nbsp;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jan 2020 16:56:10 GMT</pubDate>
    <dc:creator>Curtis_Waguespack</dc:creator>
    <dc:date>2020-01-23T16:56:10Z</dc:date>
    <item>
      <title>Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270198#M105098</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create an iLogic rule that will change the colour on one specific face of a part (a simple cuboid shape).&amp;nbsp; When I open the part and the form opens to specify the part parameters, there is a "yes/no" checkbox in there.&amp;nbsp; Selecting "Yes" means change to a specified colour (in this case green) and "No" means leave it as default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please advise of the code required to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Terry&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 15:07:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270198#M105098</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-23T15:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270236#M105099</link>
      <description>&lt;P&gt;Do you need the code to do everything? Form,etc...?&lt;/P&gt;
&lt;P&gt;Will this always be the same face on the same part or will you need to determine the face name for each different part you open?&lt;/P&gt;
&lt;P&gt;Can you post your ipt file?&lt;/P&gt;
&lt;P&gt;What version of Inventor?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic code to select a named face is..&lt;/P&gt;
&lt;PRE&gt;Dim partDoc As PartDocument = ThisDoc.Document
Dim namedEntities = iLogicVb.Automation.GetNamedEntities(partDoc)
Dim face0 As Face = namedEntities.FindEntity("Face0")
face0.Appearance = partDoc.AppearanceAssets(2)&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 15:20:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270236#M105099</guid>
      <dc:creator>mcgyvr</dc:creator>
      <dc:date>2020-01-23T15:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270318#M105100</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have a functioning part and form / rules set up.&amp;nbsp; All I am after is the code/snippets to colour one face (the same face every time) based on a true / false input for a named parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is just a simple box (cuboid).&amp;nbsp; When the part is opened the input form appears to enter Job No., Drg. No., Date etc. then the Length, Width Height.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added a true/false parameter so that a "Yes" at the prompt can be used to colour the named face green.&amp;nbsp; Otherwise a "No" leaves it alone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did right click and name the face (listed in iLogic Geometry tab) hoping that this could then be picked up in the code, but it is saying that the name is not recognized.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Inventor 2020 Professional.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this all makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Terry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS Sorry can't post the files, company rules.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 15:42:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270318#M105100</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-23T15:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270488#M105101</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an attached Inventor 2020 file as an example:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/autodesk/attachments/autodesk/78/775245/1/Cube%20Color%20Face.ipt" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/autodesk/attachments/autodesk/78/775245/1/Cube%20Color%20Face.ipt&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:&lt;BR /&gt;&lt;A href="http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120" target="_blank" rel="noopener"&gt;http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120&lt;/A&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" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code (for future searches) and a couple of screen shots concerning the face naming steps, in case those help someone else in the future as well.&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="Assign Name.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/720551i608270E2EBC9DF3D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Assign Name.png" alt="Assign Name.png" /&gt;&lt;/span&gt;&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="assign name2.PNG" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/720552i34B7B0863636FFCF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="assign name2.PNG" alt="assign name2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'set this rule to watch these parameters
oTrigger = FaceIsColored
oTrigger = FaceColor

Dim oDoc As PartDocument 
oDoc = ThisApplication.ActiveDocument

'create list of colors
Dim oList As New ArrayList
Dim oStyle As RenderStyle

For Each oStyle In oDoc.RenderStyles
  oList.Add(oStyle.Name)
Next

MultiValue.List("FaceColor") = oList

'get color name to use
Dim oColor As String
oColor = Parameter("FaceColor")

Dim oAssetLib As AssetLibrary
oAssetLib = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library")

' Get an asset in the library
Dim oLibAsset As Asset
oLibAsset = oAssetLib.AppearanceAssets.Item(oColor)


Dim oLocalAsset As Asset
Try 'Copy the asset locally.
	oLocalAsset = oLibAsset.CopyTo(oDoc)
Catch 'or just use it if it's already local
	oLocalAsset = oDoc.Assets.Item(oColor)
End Try

Dim oEntities As Object 
oEntities = iLogicVb.Automation.GetNamedEntities(oDoc)

'get the named face
Dim oFace As Face 
oFace = oEntities.FindEntity("Target Face")

'set the color if paramter is true
If Parameter("FaceIsColored") = True Then
	oFace.Appearance = oLocalAsset
Else
	oFace.Appearance = oDoc.ActiveAppearance
End If


&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 16:46:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270488#M105101</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2020-01-23T16:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270508#M105102</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It occurred to me after reading your second reply, that if you're just wanting to set the face to a known local color, then you can use a much simpler rule similar to&amp;nbsp;what mcgyvr&amp;nbsp; suggested, here's and example of that too.&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" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'set this rule to watch this parameter
oTrigger = FaceIsColored

Dim oDoc As PartDocument 
oDoc = ThisApplication.ActiveDocument

Dim oEntities As Object 
oEntities = iLogicVb.Automation.GetNamedEntities(oDoc)

'get the named face
Dim oFace As Face 
oFace = oEntities.FindEntity("Target Face")

'set the color if paramter is true
If Parameter("FaceIsColored") = True Then
	oFace.Appearance = oDoc.Assets.Item("Dark Green")
Else
	oFace.Appearance = oDoc.ActiveAppearance
End If&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 16:56:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9270508#M105102</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2020-01-23T16:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9271903#M105103</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for the replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The simplified code that you sent in the last post Curtis looks like &lt;SPAN style="font-family: inherit;"&gt;what I am after.&amp;nbsp; I put this in a test part and tried it but it is throwing up an error and I am not quite sure what it is?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Any ideas how to solve this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;I have attached the ipt and jpegs of the error messages&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Many thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Terry&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 08:40:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9271903#M105103</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-24T08:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9272685#M105104</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error is coming from the fact that Dark Green is not a local asset.... so if this is a template you can just add Dark Green to the part file manually as shown below, and then save the template.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if you're looking to make this rule more universal you'd need to use something similar to the longer version posted yesterday, which gets Dark Green from the Appearance Library and loads it locally. I've added that part of the code to your rule in the example below.&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;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Local Asset.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/720970iDE958901C35C2F13/image-size/large?v=v2&amp;amp;px=999" role="button" title="Local Asset.PNG" alt="Local Asset.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'set this rule to watch this parameter
oTrigger = Green

Dim oDoc As PartDocument 
oDoc = ThisApplication.ActiveDocument

'get color name to use
Dim oColor As String
oColor = "Dark Green"

Dim oAssetLib As AssetLibrary
oAssetLib = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library")

' Get an asset in the library
Dim oLibAsset As Asset
oLibAsset = oAssetLib.AppearanceAssets.Item(oColor)


Dim oLocalAsset As Asset
Try 'Copy the asset locally.
	oLocalAsset = oLibAsset.CopyTo(oDoc)
Catch 'or just use it if it's already local
	oLocalAsset = oDoc.Assets.Item(oColor)
End Try


Dim oEntities As Object 
oEntities = iLogicVb.Automation.GetNamedEntities(oDoc)

'get the named face
Dim oFace As Face 
oFace = oEntities.FindEntity("GreenFace")

'set the color if paramter is true
If Parameter("Green") = True Then
	oFace.Appearance = oDoc.Assets.Item(oColor)
Else
	oFace.Appearance = oDoc.ActiveAppearance
End If &lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jan 2020 14:43:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9272685#M105104</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2020-01-24T14:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9272748#M105105</link>
      <description>&lt;P&gt;In the code provided by Curtis (that caused the error for you)...&lt;/P&gt;
&lt;P&gt;If the color you want isn't "Dark Green" replace that in the code with whatever appearance name you want to use. Just spell it exactly as it is in the library.&amp;nbsp; In your case that might be "Green (Clear)" or whatever local appearance you want applied to that face.. Curtis just used "Deep Green" as an example.. Change as needed..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;oFace.Appearance = oDoc.Assets.Item("Green (Clear)")&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 15:10:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9272748#M105105</guid>
      <dc:creator>mcgyvr</dc:creator>
      <dc:date>2020-01-24T15:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9272805#M105106</link>
      <description>&lt;P&gt;Thanks very much for the replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last amended code works perfectly.&amp;nbsp; Thanks very much for all your help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Terry&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 15:33:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9272805#M105106</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-24T15:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9280997#M105115</link>
      <description>&lt;P&gt;I'm trying to use something almost identical to this, but I'd like to have the color name be a variable that is defined using a mix of text and parameters. &amp;nbsp; It will work if I define the variable using just a text string, but when I try to combine a text string with a parameter to form one long text string, it errors out.&amp;nbsp; Is this functionality not supported?&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ColorName1 = "SomeTxt-" &amp;amp; Width &amp;amp; "in-" &amp;amp; Color1'errors out
ColorName1 = "SomeTxt-36in-Color"'works fine&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Width and Color1 are parameters.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 23:34:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9280997#M105115</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-28T23:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9282947#M105147</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you add a message box line as shown below, does that return the expected string? and does that string match the name of your color (aka Appearance style name) ?&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;&lt;SPAN&gt;ColorName1&lt;/SPAN&gt; = &lt;SPAN&gt;"SomeTxt-"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Width&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"in-"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Color1&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;ColorName1&lt;/SPAN&gt;, &lt;SPAN&gt;"iLogic"&lt;/SPAN&gt;)

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 15:55:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9282947#M105147</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2020-01-29T15:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9284203#M105167</link>
      <description>&lt;P&gt;Yep, I did try that and the two strings do match.&amp;nbsp; That's what's puzzling me.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 23:45:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9284203#M105167</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-29T23:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9285871#M105189</link>
      <description>&lt;P&gt;Try the line this way.&amp;nbsp; It may just be a information type mis-match.&lt;/P&gt;&lt;PRE&gt;ColorName1 = "SomeTxt-" &amp;amp; Width.ToString &amp;amp; "in-" &amp;amp; Color1.ToString
MessageBox.Show(ColorName1, "iLogic")&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jan 2020 15:42:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/9285871#M105189</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-01-30T15:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use iLogic to assign a color to one part face</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/10078646#M120981</link>
      <description>&lt;P&gt;Hey, I used your code to change the color of selected faces, but it only works if I run it within the part. If I try to run it from the assembly where components are used it gives me following error :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;at ThisRule.Main()&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CODE USED :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;FONT color="#99CC00"&gt;Inside part :&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; 
&lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;'get color name to use&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oColor&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
&lt;SPAN&gt;oColor&lt;/SPAN&gt; = &lt;SPAN&gt;"Black"&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssetLibrary&lt;/SPAN&gt;
&lt;SPAN&gt;oAssetLib&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;AssetLibraries&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Autodesk Appearance Library"&lt;/SPAN&gt;)

&lt;SPAN&gt;' Get an asset in the library&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oLibAsset&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Asset&lt;/SPAN&gt;
&lt;SPAN&gt;oLibAsset&lt;/SPAN&gt; = &lt;SPAN&gt;oAssetLib&lt;/SPAN&gt;.&lt;SPAN&gt;AppearanceAssets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;oColor&lt;/SPAN&gt;)


&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oLocalAsset&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Asset&lt;/SPAN&gt;
&lt;SPAN&gt;Try&lt;/SPAN&gt; &lt;SPAN&gt;'Copy the asset locally.&lt;/SPAN&gt;
	&lt;SPAN&gt;oLocalAsset&lt;/SPAN&gt; = &lt;SPAN&gt;oLibAsset&lt;/SPAN&gt;.&lt;SPAN&gt;CopyTo&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;)
&lt;SPAN&gt;Catch&lt;/SPAN&gt; &lt;SPAN&gt;'or just use it if it's already local&lt;/SPAN&gt;
	&lt;SPAN&gt;oLocalAsset&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Assets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;oColor&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;


&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oEntities&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Object&lt;/SPAN&gt; 
&lt;SPAN&gt;oEntities&lt;/SPAN&gt; = &lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;Automation&lt;/SPAN&gt;.&lt;SPAN&gt;GetNamedEntities&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;)

&lt;SPAN&gt;'get the named face&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFace1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt; 
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFace2&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt; 
&lt;SPAN&gt;oFace1&lt;/SPAN&gt; = &lt;SPAN&gt;oEntities&lt;/SPAN&gt;.&lt;SPAN&gt;FindEntity&lt;/SPAN&gt;(&lt;SPAN&gt;"Tail A1"&lt;/SPAN&gt;)
&lt;SPAN&gt;oFace2&lt;/SPAN&gt; = &lt;SPAN&gt;oEntities&lt;/SPAN&gt;.&lt;SPAN&gt;FindEntity&lt;/SPAN&gt;(&lt;SPAN&gt;"Tail A2"&lt;/SPAN&gt;)

&lt;SPAN&gt;oFace1&lt;/SPAN&gt;.&lt;SPAN&gt;Appearance&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Assets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;oColor&lt;/SPAN&gt;)
&lt;SPAN&gt;oFace2&lt;/SPAN&gt;.&lt;SPAN&gt;Appearance&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Assets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;oColor&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;From assembly:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN&gt;"INSIDE RAIL"&lt;/SPAN&gt;, &lt;SPAN&gt;"Tail A"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN&gt;"OUTSIDE RAIL"&lt;/SPAN&gt;, &lt;SPAN&gt;"Tail A"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;&lt;STRONG&gt;Is there a way to make it run from the assembly ?&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 12 Feb 2021 14:47:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-ilogic-to-assign-a-color-to-one-part-face/m-p/10078646#M120981</guid>
      <dc:creator>PCP7</dc:creator>
      <dc:date>2021-02-12T14:47:47Z</dc:date>
    </item>
  </channel>
</rss>

