For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Surface or Face level colors in OpenCascade.

Vishwas Mane's picture


I am facing problem to get surface level colors in OpenCascade.

Here is the scenario;

I am trying to read STEP file with STEPCAFControl_Reader.
I am able to get number or all the colors available in a STEP file. Suppose i have 1 cube(STEP file) with all 6 faces with 6 different colors.
I able to get correct information about colors or color count with XCAFDoc_ColorTool.
When i traverse the step file with XCAFDoc_ShapeTool i get 1 body as TopoDS_Shape and when i get color of that body with XCAFDoc_ColorTool.

if (colorTool.GetColor(refShape, XCAFDoc_ColorType.XCAFDoc_ColorGen, ref col))
                                    colName = col.Name();
                                else if (colorTool.GetColor(refShape, XCAFDoc_ColorType.XCAFDoc_ColorSurf, ref col))
                                    colName = col.Name();

I get color of only one face (Inside else if (colorTool.GetColor(refShape, XCAFDoc_ColorType.XCAFDoc_ColorSurf, ref col))).

Now, i have 3 questions;

1. How do we know the TopoDS_Shape has surface level colors? &

2. How can we get surface level colors in a TopoDS_Shape?

3. Also i want to know how can i create a TopoDS_Shape(Single body) with multiple or differrent face level colors?

Thank you in advance.


Vishwas Mane's picture

Hello All,
Can anyone please at least suggest me a way to know if TopoDS_Shape has surface level colors or not.

Your time would be appreciated greatly in advance.

XM Yuan's picture

encounter the the same issue, cannot know how to get the color of the relative surface . seems the interface colorTool.GetColor(refShape, XCAFDoc_ColorSurf, ref col) failed. hoping someone help too