<?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: Get RGB color from active appearance to color Excel cell in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rgb-color-from-active-appearance-to-color-excel-cell/m-p/12847670#M168598</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5277095"&gt;@tom89Y38&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ComponentOccurrence Objects have an &lt;A href="https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-096E6F8B-ADC1-4033-AC81-5063F9FC3CED" target="_blank" rel="noopener"&gt;Appearance Property&amp;nbsp;&lt;/A&gt;which should give you the asset at assembly level instead of part level. Then once you have that asset, you can use something like this to extract the color:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim CurrentAppearance As Asset = ThisDoc.Document.ActiveAppearance

For Each value As AssetValue In CurrentAppearance
	If value.ValueType &amp;lt;&amp;gt; AssetValueTypeEnum.kAssetValueTypeColor Then Continue For
	Dim MessageTitle As String = CurrentAppearance.DisplayName &amp;amp; ": " &amp;amp; value.DisplayName
	Dim ColorVlaue As ColorAssetValue = value
	Dim messageText As String = ""
	If ColorVlaue.HasMultipleValues
		For Each c As Color In ColorVlaue.Values
			
			If messageText &amp;lt;&amp;gt; "" Then messageText = messageText &amp;amp; vbCrLf
			messageText = messageText &amp;amp; String.Format("Red: {0} | Green: {1} | Blue: {2} | Opacity: {3}", c.Red, c.Green, c.Blue, c.Opacity).ToString
		Next
	Else
		messageText = String.Format("Red: {0} | Green: {1} | Blue: {2} | Opacity: {3}", ColorVlaue.Value.Red, ColorVlaue.Value.Green, ColorVlaue.Value.Blue, ColorVlaue.Value.Opacity).ToString
	End If
	MessageBox.Show(messageText, MessageTitle)
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code above is to be run in a part file, but CurrentAsset can be set to oComp.Appearance.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2024 19:32:09 GMT</pubDate>
    <dc:creator>J-Camper</dc:creator>
    <dc:date>2024-06-18T19:32:09Z</dc:date>
    <item>
      <title>Get RGB color from active appearance to color Excel cell</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rgb-color-from-active-appearance-to-color-excel-cell/m-p/12846821#M168584</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote an iLogic rule to collect data from an assembly that's very useful to my colleagues on the shop floor.&lt;/P&gt;&lt;P&gt;One of the functions of the rule is to create an overview like this, it checks all the appearances, and overrides, sums the surface area's and weights, etc..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example assembly (contains sub assembly, 1 weld assembly with color override, 1 weld assembly without color override, 1 part)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tom89Y38_1-1718717595611.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1377263iAC9FA0092EDB5A28/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tom89Y38_1-1718717595611.png" alt="tom89Y38_1-1718717595611.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tom89Y38_2-1718717630980.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1377265i94F56EE59FB3E575/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tom89Y38_2-1718717630980.png" alt="tom89Y38_2-1718717630980.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem i'm facing: when a weld assembly has a color override, the thumbnail does not have the correct color. (This is normal because the color is given at a higher level).&lt;/P&gt;&lt;P&gt;Therefore I was thinking to have a work around and get the RGB value of the active appearance of that color override and color the corresponding Excel cell.&lt;/P&gt;&lt;P&gt;I just can't figure out how to get the RGB color values of the active appearance on a correct way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my code I'm already looping through all component occurrences like this&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub ProcessWeldAssembliesWithOverrides(oAssembly As AssemblyDocument) 'subprogramma
		' Loop door de alle componenten in de assembly
		For Each oComp As ComponentOccurrence In oAssembly.ComponentDefinition.Occurrences&lt;/LI-CODE&gt;&lt;P&gt;So it would be great if I could get the RGB values of oComp in that same loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas to help me out?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 13:45:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rgb-color-from-active-appearance-to-color-excel-cell/m-p/12846821#M168584</guid>
      <dc:creator>tom89Y38</dc:creator>
      <dc:date>2024-06-18T13:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get RGB color from active appearance to color Excel cell</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rgb-color-from-active-appearance-to-color-excel-cell/m-p/12847670#M168598</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5277095"&gt;@tom89Y38&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ComponentOccurrence Objects have an &lt;A href="https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-096E6F8B-ADC1-4033-AC81-5063F9FC3CED" target="_blank" rel="noopener"&gt;Appearance Property&amp;nbsp;&lt;/A&gt;which should give you the asset at assembly level instead of part level. Then once you have that asset, you can use something like this to extract the color:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim CurrentAppearance As Asset = ThisDoc.Document.ActiveAppearance

For Each value As AssetValue In CurrentAppearance
	If value.ValueType &amp;lt;&amp;gt; AssetValueTypeEnum.kAssetValueTypeColor Then Continue For
	Dim MessageTitle As String = CurrentAppearance.DisplayName &amp;amp; ": " &amp;amp; value.DisplayName
	Dim ColorVlaue As ColorAssetValue = value
	Dim messageText As String = ""
	If ColorVlaue.HasMultipleValues
		For Each c As Color In ColorVlaue.Values
			
			If messageText &amp;lt;&amp;gt; "" Then messageText = messageText &amp;amp; vbCrLf
			messageText = messageText &amp;amp; String.Format("Red: {0} | Green: {1} | Blue: {2} | Opacity: {3}", c.Red, c.Green, c.Blue, c.Opacity).ToString
		Next
	Else
		messageText = String.Format("Red: {0} | Green: {1} | Blue: {2} | Opacity: {3}", ColorVlaue.Value.Red, ColorVlaue.Value.Green, ColorVlaue.Value.Blue, ColorVlaue.Value.Opacity).ToString
	End If
	MessageBox.Show(messageText, MessageTitle)
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code above is to be run in a part file, but CurrentAsset can be set to oComp.Appearance.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 19:32:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rgb-color-from-active-appearance-to-color-excel-cell/m-p/12847670#M168598</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2024-06-18T19:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get RGB color from active appearance to color Excel cell</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rgb-color-from-active-appearance-to-color-excel-cell/m-p/12848782#M168616</link>
      <description>&lt;P&gt;In addition to &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;&lt;/P&gt;&lt;P&gt;The above code will probably show you that there are two ColorAssetValues per Asset. You're looking for the one with .DisplayName&amp;nbsp; 'color' (opposed to the one displaynamed 'Tint').&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 08:40:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/get-rgb-color-from-active-appearance-to-color-excel-cell/m-p/12848782#M168616</guid>
      <dc:creator>_dscholtes_</dc:creator>
      <dc:date>2024-06-19T08:40:59Z</dc:date>
    </item>
  </channel>
</rss>

