OCAF attribute

How I can implement a my attribute in ocaf?
I must derive may class attribute from TDF_Attribute?

Thanks in advance

Igor

Valery Ovchinnikov's picture

Yes, you must derive your class from TDF_Attribute and point GUID in files Plugin and Resource.
You can see, for example, classes like TDataStd_Real,..

Igor Khozhanov's picture

Thank you Valery.

Dirk B's picture

Hello!
I am trying to create my own attribute. I copied TDataStd_Integer.cxx, .ixx, .jxx, .hxx, and the Handle_ file, renamed all occurrences of TDataStd_Integer to my own attributes name and replaced the guid with another one. Storing and retrieving the data in the attribute works fine as long as I don't save the document. After loading a document containing my own attribute, I can not find it in the tree. I guess I am missing to "point" the guid in the files "Resource" and "Plugin". Into which files and how should I put the guid? Could you please give me an example?

Thanks,

Dirk

Denis Teissandier's picture

This problem is known as a major problem.

If you want to save your attributes in a document (i.e. manipulate persistent data), you have to create your drivers (i.e. resource and plugin). This is very hard to develop.

You will find no assistance to do that in the OCC documentation and in the comments of the cdl files.

If you manipulate only transient data (without saving tour attributes in a document file), it works fine !

To avoid this problem, I always use the attribute of a OCC release.

Regards,

Denis

Dirk B's picture

Thank you for your answer. Now I'm just putting all my data into available classes derived from TDF_Attribute. I hope that I understood correctly. It's not nice to have to do it this way, without being able to identify the data in the tree by attribute type. But at least it works.

Dirk