How to give/retrieve a name for a AIS_Shape

I am just doing the bottle tutorial and it works great. How can I give a name to the bottle, and how to retrieve the name of the AIS_Shape? My application is using wxWidgets and so it is not based on OCAF documents. Is it possible?

Kirill Gavrilov's picture

AIS_Shape is an Interactive Object which has no any name.
If you would like to associate presentations with names, you can define a map (AIS_InteractiveObject, String) at application level or store name directly in Interactive Object (e.g. by sub-classing or by using Owner property).

mfregeau's picture

Can you give me an example how to set (or get) the owner? so I can set (or get) a name for the shape. My code to create the bottle is as following:

TopoDS_Shape aBottle;
Handle(AIS_Shape) AISBottle=new AIS_Shape(aBottle);
mContext->Display(AISBottle, Standard_False);

Kirill Gavrilov's picture

Check documentation of method AIS_InteractiveObject::SetOwner(). Argument is any transient object - defined by application or standard OCCT classes (like TCollection_HAsciiString holding string).