STEPControl_Writer false

Hello, i export an assembly(which is TopoDS_Compound, it contaning one solid and one compound) to step file.But there were something went wrong.The problem is that when i use writer.Transfer(assembly, STEPControl_AsIs), this process change the index of solid and compound as shown in picture. The left part of the picture is correct assemly tree before i use writer.Transfer(assembly, STEPControl_AsIs), and the right part is the assembly tree of step file, which is wrong.

Beside, i can get correct assemly tree structure in step file with more complicated structure, but this simple assembly tree structure went wrong.

Any help is greatly appreciated. Thank you!

Best Regards! Xiaoqi

Dmitrii Pasukhin's picture

Hi, could you share STEP file? On some cases model can be modified during export or import. We can't guarantee that tree will be always the same. Only XBF format is safety.

Best regards, Dmitrii.

xiaoqi wang's picture

Hello Dmitrii,
I operate in sandbox, so i can't paste the step file here.But i tested an example, the code is shown as follow, and SS in the code is Shapeset:

TopoDS_Compound comRoot;
TopoDS_Compound com1;

BRep_Builder builder;
builder.MakeCompound(comRoot);
builder.MakeCompound(com1);

TopoDS_Shape s1 = SS.Shape(109);
TopoDS_Shape s2 = SS.Shape(110);

builder.Add(com1, s2);
builder.Add(comRoot, com1);
builder.Add(comRoot, s1);

STEPControl_Writer writer;
IFSelect_ReturnStatus status = writer.Transfer(comRoot, STEPControl_AsIs);
if(status != IFSelect_RetDone){
return nullptr;
}
writer.Write("filename.step");

The view of filename.step file and comRoot are presented in the picture. The view of comRoot(Right part) is the tree i build and correct.

Thank you very much!
Best Regards!
Xiaoqi

xiaoqi wang's picture

Hello Dmitrii,
What's more, if i add one shape s3(index = 110, the big one) in com1, the result will be correct.As shown in the picture.
Best Regards!
Xiaoqi

Attachments: