Thu, 07/06/2023 - 15:21
Hey,
I'm trying to export a subassembly of a step file. The way i have been doing this, is by creating a new doc, and shapetool, and then i use shapetool->newshape.
Handle(TDocStd_Application) app = new TDocStd_Application();
Handle(TDocStd_Document) newDoc;
app->NewDocument("NewDocumentFormat", newDoc);
TDF_Label emptyShape = newShapeTool->NewShape();
Handle(XCAFDoc_ShapeTool) newShapeTool = XCAFDoc_DocumentTool::ShapeTool(newDoc->Main());
newShapeTool->AddComponent(newDoc->Main(), label, trsf);
writer.Transfer(newDoc);
writer.Write(path);
This works, but it adds the subassembly one level under the emptyShape, which is as expected. Is there any way to create a step file where "label" is the root node of my assembly?
Fri, 07/07/2023 - 11:44
Hello,
I need more prehistory of your task. Whay you have as an input. What you awaiting as an output and more.
But for coping shapes from one document to another or copy within one document you can use XCAFDoc_Editor::CloneShapeLabel. It is growing tool. You need to have version 7.6.3 or upper.
Best regards, Dmitrii.
Wed, 07/12/2023 - 12:36
Hey, in the attachments is an example assembly where im trying to export the subassembly with the name '1' (just a part in this case). Since im adding the part to the emptyShape, the root level is "Open CASCADE STEP translator 7.6.1". I would like to export the part without this top level.
capture.png is the input
capture2.png is the output
Wed, 07/12/2023 - 13:39
You create an assembly and would like to avoid export assembly. I think you need to use just AddShape method to add simple shape into document w/o dummy root.
If are you talking about name, you be able to give your own name this assembly.
Best regards, Dmitrii.
Wed, 07/12/2023 - 13:53
Moreover, you don't need to recreate a xcaf.
STEPCAFControl_Writer has methods to export just a single TDF_Label from your origin XCAF document.
Best regards, Dmitrii.