OCAF: Attribute driver not found


I am working with a simple OCAF example I have found on the internet. It adds some data to a document and saves it. This is the code:

TopoDS_Shape aBottle = makeBottle(50, 70, 30);
Handle(AIS_Shape) AISBottle = new AIS_Shape(aBottle);

//Create an application
Application *application= new Application();

//Attach document to application
Handle(TDocStd_Document) document;

//Get main (root) label
TDF_Label root=document->Main();

//Create child label with tag of your choosing
TDF_Label aLabel=root.FindChild(1,Standard_True);

//Register shape of your choosing with aLabel
TNaming_Builder builder(aLabel);

//Create new integer attribute on aLabel
Handle(TDataStd_Integer) INT = new TDataStd_Integer();

application->SaveAs( document, "/home/bbihler/Test.cop");

This works great and if I reload the document, everything is there including the shape.

But when I try to change the format and alter the document creation to:


then there are errors during saving. It says:

XmlDrivers : Storage Plugin
Variable CSF_XmlOcafResource has not been explicitly defined. Set to /usr/local/share/oce-0.13-dev/src/XmlOcafResource
attention etat fantomatique
attribute driver for type TNaming_UsedShapes not found
attribute driver for type TDocStd_Owner not found
attention etat fantomatique
First step successfull
TDocStd_Application::SaveAs(): The status = 0

The created xml document is so small that it is obviously not correct.
I have googled for the error message "attribute driver not found", but I haven't found anything that helped me solve the issue.

Could you tell me what I have to do to be able to save this data in XML format?

Thank you very much!


Benjamin Bihler's picture

Unfortunately my code above contains some error. The original code used


With this line storing the data worked. The second version with


does not work.

Is it possible to store shapes in the XmlOcaf format at all?

Or do I have to implement attribute drivers for the XmlOcaf format that exist already for the MDTV-Standard format?

Any help is really appreciated!!!

Forum supervisor's picture

Dear Benjamin,
Yes it is possible.
If the problem is critical for you, you may contact us via the Contact Form http://www.opencascade.org/about/contacts/.
Training and e-learning courses are also at your disposal - http://www.opencascade.org/support/training/.
Best regards

Benjamin Bihler's picture

Thank you for your hint. You wrote that it is possible to store shapes in the XmlOcaf format. May I ask whether this is possible with the basic OCC version, i.e. without "value-added software"?

For I realized that in the XCAF file there are attribute storage/retrieval plug-ins only defined for the MDTV-Standard-format and not for the other formats!

Forum supervisor's picture

Dear Benjamin,
Yes, it is feasible to store shapes in Xml format.
The "value-added software" has no any connection with storage formats.

Benjamin Bihler's picture

For those who have the same problem: there is/was a bug in the OpenCascade Community Edition which broke storing of shapes in XML files. As far as I know the official edition never showed this misbehaviour.

Shing Liu's picture

Hi Benjamin,
For the different file format, I think you can refer to the '4.3.3 Saving the document' in OpenCascade6.6.0 Application Framework User's Guide Page 25, or in OpenCascade 6.7.0 OCAF Page 19.