Color of the Model

Color of the Model

Anonymous
Not applicable
647 Views
1 Reply
Message 1 of 2

Color of the Model

Anonymous
Not applicable

I want to access the color of each face of body in Autodesk Fusion 360  . Following procedure I have tried


for (int faceLoopCnt = 0; faceLoopCnt < facesCount; faceLoopCnt++)
{
    Ptr<BRepFace> faceCurr = bfaces->item(faceLoopCnt);   
    Face faceData;   
    Ptr<Appearance> appearance = faceCurr->appearance();   
    int appearanceCount =(int) appearance->appearanceProperties()->count();
    string appearancePropertyName[100];
    for (int i = 0; i < appearanceCount; i++)
    {
        appearancePropertyName[i] = appearance->appearanceProperties()->item(i)->name();       
        if(appearancePropertyName[i]=="Color")
        {           
            short red1,green1,blue1;
            Ptr<ColorProperty> colorProperty = appearance->appearanceProperties()->item(i);   
            red1= colorProperty->value()->red();    
            green1 = colorProperty->value()->green();   
            blue1 = colorProperty->value()->blue();                                       
        }   
    }       
}

 

find attachments below,
Which color property to use,

It is not giving proper output. (In both cases, values are not correct).
But (205,46,46) RGB color is expected.


 

 

 

 

0 Likes
648 Views
1 Reply
Reply (1)
Message 2 of 2

zhijie.li
Alumni
Alumni

Hi prashant,

 

There can different properties with same name "Color". Take Steel -Satin, there is "Color" property which defines the appearance color, and another one for Advanced Highlight Controls. You can distinguish them by the property id. You can refer to property list of Steel -Satin as following image.

Capture01.pngCapture02.png

 

It is not clear that why the color is not the value as expected. I did some tests locally, it worked fine. Maybe the appearance got from the face is not as expected. You can try to get apearance name or id to check if the appearance is what you expect.

0 Likes