For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

OpenCASCADE 6.5.2 save OCAF document

Mikko Lyly's picture

Dear all,

The release notes of OpenCASCADE 6.5.2 say that the plugin system for Application Framework has changed. In particular, there seems to be no StdPlugin anymore since the functionality can be found from other packages (item 22152 in release notes).

My question to you is, how should I accommodate with these changes? Below is a small self contained snippet which fails to save an OCAF document. The application loads the FWOSPlugin plugin fine, the document seems valid, and it draws correctly on the screen. However, saving the document fails with PCDM_SS_Failure. Is there something I'm overlooking here?


// Create the application and document
Handle(TDocStd_Document) document;
Handle(XCAFApp_Application) application = XCAFApp_Application::GetApplication();
application->NewDocument("XmlXCAF", document);
Handle(XCAFDoc_ShapeTool) shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());

// Add a simple shape to the document
TopoDS_Shape cylinder = BRepPrimAPI_MakeCylinder(100, 200);
TDF_Label cylinderLabel = shapeTool->AddShape(cylinder);
TDataStd_Name::Set(cylinderLabel, "Cylinder");

// Save the document
TCollection_ExtendedString fileName("test.xcaf");
PCDM_StoreStatus storeStatus = application->SaveAs(document, fileName);
if(storeStatus != PCDM_SS_OK) std::cerr

Mikko Lyly's picture

Sorry, in the above example "fileName" should of course read "path".

Then, a small addition: I'm working on win32. The following returns PCDM_SS_OK but nothing is saved:

application->SaveAs(document, "C:\\Tmp\\test");

The following, on the other hand, returns PDCM_SS_Failure and error message "SaveAs: No such directory" even though the directory in reality exists:

TCollection_ExtendedString statusMessage;
application->SaveAs(document, "C:\\Tmp\\test", statusMessage);

Mikko Lyly's picture

Ok, got it working.

I had CSF_XCAFDefaults pointing to a directory which contained an old corrupted XCAF-file.

Sorry for the noise.


Hesham Nasif's picture

File saving in OCAF is producing a very big file size. I imported file in a step format produced by other software but just transferring it and save it i found the new file 4 times larger than the original one even i did not do any changes on it