Wed, 07/12/2023 - 10:25
Hello,
Im working on an application where i read a step file, but i have issues with large file sizes. I have a large step file of 50MB, and when i export a small sub assembly of this file, the size is more than 40MB.
//reading
STEPCAFControl_Reader Reader;
Handle(TDocStd_Application) app = new TDocStd_Application;
BinXCAFDrivers::DefineFormat(app);
app->NewDocument("BinXCAF", doc);
Reader.ReadFile(filename);
Reader.Transfer(doc);
//writing
Handle(TDocStd_Application) newApp = new TDocStd_Application();
Handle(TDocStd_Document) newDoc;
newApp->NewDocument("NewDocumentFormat", newDoc);
Handle(XCAFDoc_ShapeTool) newShapeTool = XCAFDoc_DocumentTool::ShapeTool(newDoc->Main());
TDF_Label emptyShape = newShapeTool->NewShape();
newShapeTool->AddComponent(emptyShape, reflabel, mytrsf); //reflabel is my small subassembly
STEPCAFControl_Writer writer;
writer.Write(Path.c_str());
I'm affraid i can not share the step file with you. If it is really neccesary, I could find a different step file online and try to replicate this scenario. Maybe there is something wrong about the way i am reading or exporting the file? Or maybe this is a known issue in Open Cascade?
Wed, 07/12/2023 - 11:17
There can be a lot of reason of growing up of the file size: different ISO version(214, 242 ...), writing PCurve, dummy entities.
If you be able to share a file, which helps us to reproduce - I will be able to help you.
Best regards, Dmitrii.
Wed, 07/12/2023 - 12:37
Hey Pasukhin, thanks for the fast response! I found a step file online. It's not as big as my private step file, but the same thing happens. The exported sub-assembly is even larger than the original file in this case. See the attachments. I also included my exported sub assembly.
Wed, 07/12/2023 - 13:00
I was right. There a lot of new PCurve and more.
You need to modify static parameters to disable writing PCurves.
Best regards, Dmitrii.
Wed, 07/12/2023 - 13:09
Works like a charm, you are amazing. Thanks!