How to get an appearance color?

How to get an appearance color?

Anonymous
Not applicable
762 Views
3 Replies
Message 1 of 4

How to get an appearance color?

Anonymous
Not applicable

Hi there!

 

I'm trying to get render data (such as diffuse color, roughness and so on), and faced that RenderStyle from Material contains material color (titanium on the screenshot below), but I need a representation color (Anodized - dark red), and I can't find how to get it.

Does anybody know something about this all? 🙂

 

Thank you!

 

anodized.png

0 Likes
Accepted solutions (1)
763 Views
3 Replies
Replies (3)
Message 2 of 4

JhoelForshav
Mentor
Mentor

It sound like you want to get the appearance, not the material 🙂

An example rule to get the appearance name of a part body:

Dim oSurfBod As SurfaceBody = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Select Body")
MsgBox(oSurfBod.Appearance.DisplayName)
Message 3 of 4

Anonymous
Not applicable

Thanks for your reply!

 

Actually, I'm trying to collect physical-based data, such as color, opacity, refraction, and so on.

And in this particular case, I faced this anodized appearance of titanium and I need to get RGB data of it... and I can't find how 🙂

 

Your snipped doesn't work on my side - throws COM exception (I use C#), but thanks to your idea I found that I can get the surface body's Appearance through SurfaceBodies from ComponentOccurrence. And that's correct Appearance, but this appearance struct (Asset) doesn't contain information about the color which I'm looking for...

 

appearance.png

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

All render data one can get from RenderStyle for each Face of Body:

foreach (SurfaceBody surfBody in compOccurrence.SurfaceBodies)
{
    foreach (Face face in surfBody.Faces)
    {
        StyleSourceTypeEnum StyleSourceType;
        RenderStyle faceRenderStyle = face.GetRenderStyle(out StyleSourceType);
    }
}

 

0 Likes