AnsweredAssumed Answered

Need RGB from Appearance Color

Question asked by Hepzibah Chandranand on Jul 24, 2019

The color property in the AppearanceSettings can be set using the RGB values like this:

color_value = MAX(MIN(red_rgb_value,255),0) + MAX(MIN(green_rgb_value,255),0)*16*16 + MAX(MIN(blue_rgb_value,255),0)*16*16*16*16

Ref: http://help.solidworks.com/2017/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IAppearanceSetting~Color.html

 

The component uses an appearance file 'satin finish aluminum.p2m' (attached)

The dominant color of this component is

Using the above equation the color value should be = 16733263

 

I use swModelDocExt.get_DisplayStateSpecMaterialPropertyValues() using swDisplayStateOpts_e.swThisDisplayState for DisplayStateSetting to get the AppearanceSetting.  But, the color value returned is 15592165

 

Why is it different? Can someone please explain.

 

How can I get the RGB value of the Dominant color from the appearance color integer value?

( I need RGB[79, 84, 255] from Appearance Color integer 15592165 )

 

Attachments

Outcomes