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

Ocaf and UAttribute

Fabrizio's picture
Forums: 

Hi all, I've a question about using UAttribute in Ocaf document. If I need to define an UAttribute that contain for instance a reference (as C++ pointer) to my C++ Object, How do I do to define this attribute? I don't understend if I need to define a new class that inherit from UAttribute. Is there somebody that provide me an example?

Thanks Fabrizio.

Sergey RUIN's picture

Hi Fabrizio,

UAttribute isn't supposed for storing any reference. The only purpose of UAttribute is to store arbitary GUID. For example if there is a need to assign to the TDF_Label a semantic.

To have attribute that stores a reference to some C++ object you need to create your own attribute that inherits from TDF_Attribute, redefine its virtual methods (only Paste, Restore, NewEmpty and ID have to be mandatory redefined) then add methods to Set/Get your reference and a field to store it in the attribute.

That's enough to have a Transient version of the attribute.

Best Regards

Sergey

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.