Sun, 12/15/2024 - 19:48
I want to write edges in to step file to so that when the file is read, they are read as edges and not compound shapes. This shows up in the hierarchy. Attached (desired.png) the desired hierarchy - Currently, I am writing it like this -
BRep_Builder builder;
TopoDS_Compound compound;
builder.MakeCompound(compound);
std::for_each(shapes.begin(), shapes.end(), [&compound, &builder](const TopoDS_Shape& shape)
{
if (shape.IsNull())
throw std::runtime_error("Empty shape encountered");
builder.Add(compound, shape);
});
const TDF_Label freeShape = shapeTool->AddShape(compound, Standard_False);
// set the catalogName on each Shape in the assembly
const TCollection_ExtendedString aName(catalogName.data());
TDataStd_Name::Set(freeShape, aName);
shapeTool->AddComponent(label, freeShape, transform);
TDF_Label colorLabel;
Standard_Boolean isFound = shapeTool->SearchUsingMap(coloredShape.first, colorLabel, Standard_False, Standard_True);
if (isFound)
{
colorTool->SetColor(colorLabel, color.first, XCAFDoc_ColorGen);
}
This is giving me undesired hierarchy. Any pointers on how to write the edges so that they do not become compounds? I do not understand why even if I am writing individual edge as TopoDS_Edge, it is coming up as a compound when reading the file.
Attachments:
Mon, 12/16/2024 - 12:51
Hello. To make assembly, not a compaund - need to make flag to true to AddShape:
Additionally Add component will work if you will force add "makePrepare" force.
Best regards, Dmitrii.