TDF_Labels for solids and faces

Hello Community,

I sucessfully managed to load and display a step file with XDE.
It consists of one assembly with to solids.
GetFreeShapes returns 1 label and I attached a TPrsStd_AISPresentation to it.

The next step I want to take is adding custom data to the solids and faces in the assembly.
I am able to select individual solids and faces
but when I get the TPrsStd_AISPresentation with SelectedInteractive()->GetOwner() it refers to the assembly.

Should I add Labels in the document for the solids and faces also? I think I have to
What is the best way to do this? I partly succeeded with using ShapeTool::GetComponents on the freeshapes
but that only gave me the solids.

In the mean time I will read the XDE and OCAF guides again.



Arjan Schouten's picture

Never mind

void Model::selectionDone()
TDF_Label label;

Handle(XCAFDoc_ShapeTool) hShapeTool = XCAFDoc_DocumentTool::ShapeTool(m_hDocument->Main());

for(m_hContext->InitSelected(); m_hContext->MoreSelected(); m_hContext->NextSelected())
const TopoDS_Shape shape = m_hContext->SelectedShape();

if(shape.ShapeType() == TopAbs_SOLID)
if(hShapeTool->FindShape(shape, label))
//do something with solid

if(shape.ShapeType() == TopAbs_FACE)
if(hShapeTool->Search(shape, label))
//do something with face