<?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: Find Face with FaceColor Attributes with iLogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-face-with-facecolor-attributes-with-ilogic/m-p/8386696#M91110</link>
    <description>&lt;P&gt;I was completely wrong about where I thought the problem was. When I looked at this fresh this morning I noticed that the&amp;nbsp;oPartDoc is referencing "ThisApplication.ActiveDocument". In my assembly I am passing variables to the part file, executing code in that part file, but it is not the active document, my assembly file is. Changing oPartDoc to "ThisDoc.Document" fixed the problem and all is good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oPartDoc As PartDocument 
oPartDoc = ThisDoc.Document 'ThisApplication.ActiveDocument&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2018 17:54:37 GMT</pubDate>
    <dc:creator>insomnix</dc:creator>
    <dc:date>2018-11-07T17:54:37Z</dc:date>
    <item>
      <title>Find Face with FaceColor Attributes with iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-face-with-facecolor-attributes-with-ilogic/m-p/8384690#M91082</link>
      <description>&lt;P&gt;The below code works great when used within a part file, but when I add the part to an assembly, the part errors. For example, a single line of iLogic code in the assembly to change the width of the part will cause the part file to run its iLogic code, and error. When I comment out the below code, the part updates correctly in the assembly. I think the error is in the&amp;nbsp;"com.autodesk.inventor.FaceAttributes" line, but I don't know how else I can find&amp;nbsp;each face to update.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Dim oPartDoc As PartDocument 
    oPartDoc = ThisApplication.ActiveDocument 

    ' Get all of the faces that have the "FaceColor" attribute. 
    Dim oFaces As ObjectCollection 
    oFaces = oPartDoc.AttributeManager.FindObjects( "com.autodesk.inventor.FaceAttributes", "FaceColor")

    ' Iterate through all faces that have colors and change. 
    Dim oFace As Face
    Dim oAssets as Assets
    oAssets = oPartDoc.Assets
	
    Dim oAsset as Asset
    oAsset = oAssets.Item("Bamboo")
    
    For Each oFace In oFaces 
         oFace.Appearance = oAsset
    Next&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 541px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/566459i9F652599013C630A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 00:53:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-face-with-facecolor-attributes-with-ilogic/m-p/8384690#M91082</guid>
      <dc:creator>insomnix</dc:creator>
      <dc:date>2018-11-07T00:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Find Face with FaceColor Attributes with iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-face-with-facecolor-attributes-with-ilogic/m-p/8386696#M91110</link>
      <description>&lt;P&gt;I was completely wrong about where I thought the problem was. When I looked at this fresh this morning I noticed that the&amp;nbsp;oPartDoc is referencing "ThisApplication.ActiveDocument". In my assembly I am passing variables to the part file, executing code in that part file, but it is not the active document, my assembly file is. Changing oPartDoc to "ThisDoc.Document" fixed the problem and all is good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oPartDoc As PartDocument 
oPartDoc = ThisDoc.Document 'ThisApplication.ActiveDocument&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 17:54:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-face-with-facecolor-attributes-with-ilogic/m-p/8386696#M91110</guid>
      <dc:creator>insomnix</dc:creator>
      <dc:date>2018-11-07T17:54:37Z</dc:date>
    </item>
  </channel>
</rss>

