Save triangulation data into XCAF document

Hello,
I'm transferring a STEP file into a BinXCaf Document, meshing the shapes (BRepMesh_IncrementalMesh), then saving the document (application->SaveAs()) into a file.
When reloading the document (application->Open()), all the triangulation data seems to be gone, and needs to be re-computed.

Is there an option somewhere to save the triangulation data in the xbf ?
Best,

gkv311 n's picture

You may pass this parameter to storage driver. Something like this (from StoreTriangulation command in Draw Harness):

const Handle(TDocStd_Application)& anApp = ...;
Handle(BinDrivers_DocumentStorageDriver) aDriverXCaf = Handle(BinDrivers_DocumentStorageDriver)::DownCast(anApp->WriterFromFormat ("BinXCAF"));
const Standard_Boolean toEnable = true;
aDriverOcaf->SetWithTriangles(anApp->MessageDriver(), toEnable);
Antoine H's picture

It seems to work like a charm ! Thanks.