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

Can not get colors of faces

Selman Uslu's picture
Forums: 

While i triangulate a shape, I explore all the faces and trying to get their colors by using XCAFDoc_ColorTool GetColor method.

Since i updated to OpenCascade 7.4.0, i cannot get colors.

Does anyone know this situation?  

myAssembly->GetFreeShapes(labels);

nbS=labels.Length();

for(int i=1;i<=nbS;++i)

{

const TDF_Label& label=labels.Value(i);

myAssembly->GetShape(label,shape);

Triangulate(shape);

}
Handle(XCAFDoc_ColorTool) colors;

Quantity_Color color;

TopoDS_Face face=TopoDS::Face(explorer.current());

if(colors->GetColor(face,XCAfDoc_ColorGen,color)||colors->GetColor(face,XCAfDoc_ColorSurf,color)||colors->GetColor(face,XCAfDoc_ColorCurv,color))

{

// Always it comes false

}

Kirill Gavrilov's picture

Which file format do you open?

Selman Uslu's picture

Step File

Kirill Gavrilov's picture

Colors might be assigned in various ways within STEP file - iterating over shape Faces is only one place where colors might be found.
Have you tried displaying your model in Draw Harness or in CAD Assistant? Are there any colors?

pload OCAF XDE VISUALIZATION
ReadStep D myStep.stp
vinit
XDisplay -dispMode 1 D
vfit

XCAFPrs::CollectStyleSettings() is more reliable way to collect color information within the document.

Selman Uslu's picture

thanks for your advice. I've done it.

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.