Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / OpenCASCADE 6.5.2 save OCAF document

OpenCASCADE 6.5.2 save OCAF document

OpenCASCADE 6.5.2 save OCAF document
Mikko Lyly 2012/03/09 20:28
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?

Best,
ML

// 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 << storeStatus << "\n";
Mikko Lyly 2012/03/09 22:09
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);
std::cerr << statusMessage << "\n";


Mikko Lyly 2012/03/10 09:51
Ok, got it working.

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

Sorry for the noise.

ML
Hesham Nasif 2013/04/02 12:24
     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
 
 
Latest news
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map