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

XCAF Woes

Carsten Zerbst's picture
Forums: 

Hello,

I have serious problems with PRODUCT names in STEP files created with XCAF.
My program has several method, one to create the assembly structure and others to create the part geometries.

The resulting STEP document contains the right name on the root assembly and all other assembly nodes, where the geometry is created in the very same method. On the other hand all geometry created in other method is contained in the right shape, but has names like "RootAssembly 1.1" in the STEP file.

If I add geometry instead of the one contained in the map, the names are right again.

Handing over shape and id seems to cause problems with XCAF, are there valid alternatives ?

--------------- Create assembly ---
aDoc = new TDocStd_Document("dummy");
Handle(XCAFApp_Application) app = XCAFApp_Application::GetApplication();
app->NewDocument("MDTV-XCAF", aDoc);

gp_Trsf t0/*identity*/;
TopLoc_Location location0(t0);
Handle(XCAFDoc_ShapeTool) rootAssembly = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
labelA0 = rootAssembly->NewShape();
TDataStd_Name::Set(labelA0, "RootAssembly"); //

map name2topo;

mapGeometries(name2topo);

std::map<:string topods_shape="">::const_iterator it;
for (it = name2topo_defined.begin(); it != name2topo_defined.end(); ++it) {
id = it->first;
#ifdef TEST
shape = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), gp_Pnt(10, 30, 20)); // #else
shape = it->second; // #end
label = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main())->NewShape();
XCAFDoc_DocumentTool::ShapeTool(aDoc->Main())->SetShape(label, shape);
TDataStd_Name::Set(plateLabel, id.c_str());

TDF_Label component01 = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main())->AddComponent(labelA0, label, location0);
TDataStd_Name::Set(component,id.c_str());
}