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

XCAFDoc_ShapeTool::Search and located sub shapes

Arjan's picture


I succesfully loaded a step file with XDE and displayed it.
It is an assembly containing one solid. Now I want to change the color of the face
with XCAFDoc_ColorTool::SetColor(TopoDS_Shape& S,const Quantity_Color& Color,const XCAFDoc_ColorType)

The face is obtained with AIS_InteractiveContext::SelectedShape which returns a TopoDS_Shape (of type TopoDS_Face) which resulted from decomposition of the assembly (TopoDS_Compound)

SetColor returns false because SetColor calls XCAFDoc_ShapeTool::Search to obtain a label for the face but that fails because the face has a location. Is this the intent? If I remove the location it works.

This fails

TopoDS_Shape shape = m_hContext->SelectedShape();
hColorTool->SetColor(shape, color, XCAFDoc_ColorSurf);

This works

TopoDS_Shape shape = m_hContext->SelectedShape();

// remove location from shape
TopLoc_Location loc;
shape = shape.Located(loc);

hColorTool->SetColor(shape, color, XCAFDoc_ColorSurf);

Is this the way it should work or am I missing something?



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.