XDE vs SubShapes

Handle (TDocStd_Document) doc = new TDocStd_Document("qwe");

TopoDS_Solid box= BRepPrimAPI_MakeBox(10, 10, 40);
TDF_Label aLabel = STool->AddShape(box, true);
TCollection_ExtendedString aName = "JustBox";
TDataStd_Name::Set(aLabel, aName);

TopoDS_Solid box2= BRepPrimAPI_MakeBox(120, 10, 40);
TDF_Label aLabel2 = STool->AddSubShape(aLabel, box2); //return NULL, why?
TCollection_ExtendedString aName2 = "JustSubBox";
TDataStd_Name::Set(aLabel2, aName2);

So I was unable to add sub shape, could somebody suggest how to do it in right way?

Patrik Mueller's picture

Hi,

I think STool should be the XDE ShapeTool? If so you tried adding a TopoDS_Solid as a child of another TopoDS_Solid? I think you should use TopoDS_Compounds for building SubShapes!

HTH,

Patrik

Peter's picture

Thank you for answer,

>I think STool should be the XDE ShapeTool?
yes:

Handle (XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool (doc->Main());

>If so you tried adding a TopoDS_Solid as a child of another TopoDS_Solid?

yes

>I think you should use TopoDS_Compounds for building SubShapes!

but how to do it? (if there is any example?)

Patrik Mueller's picture

Hi Peter,

there are some simple examples in the XDE pdf.

HTH,

Patrik