Problems saving OCAF

I'm trying to save a simple OCAF structure, but OCC claims "No storage driver does exist for this format: XCAF".
I followed the OCAF tutorial but once again there are only some poor information about how to realize the operations.

My code snippet looks like this:

CDF_StoreStatus saveStatus = app->SaveAs(doc, extPath, statusMessage);
if (saveStatus != CDF_SS_OK )
{
switch ( saveStatus ) {
case CDF_SS_DriverFailure: {
PRINT("No driver found: " break ;
}
case CDF_SS_WriteFailure: {
PRINT("Write access failure:" break;
}
case CDF_SS_Failure: {
PRINT("Write failure:" break;
}
}
}

And yes, the doc has been initialized and the path does exist. I'm using a standard windows installation of OCC6.2, so even the variables CSF_PluginDefaults and CSF_XCAFDefaults are set correctly.
May be it's worth to mention that when trying to call
doc->ChangeStorageFormat("XmlOcaf");
before save operation, the application crashes, too.

Any help is very welcome.

Even a list of steps in preparation of a save operation would be helpful. E.g. I don't understand how to use the function "FromTo()" that is recommended in the tutorial to create a persistent version of the document

Thank you in advance.

Denis Teissandier's picture

You need the 3 following variables in your env.vat file :

set CSF_StandardDefaults=%CASROOT%\src\StdResource
set CSF_PluginDefaults=%CASROOT%\src\StdResource
set CSF_XCAFDefaults=%CASROOT%\src\StdResource

If you list the file in the path %CASROOT%\src\StdResource, you will notice that you can use only the 3 following formats :
MDTV-Standard
XmlOcaf
BinOcaf

The XCAF format does not exist.

If you want to use the XCAF format, you have to add it in the file. You have to verify if the different drivers that you want to use exist in the file.

regards,

Denis Teissandier