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

How to give/retrieve a name for a AIS_Shape

Mimosa Olive's picture
Forums: 

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'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).

Mimosa Olive'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;
aBottle=MakeBottle(50,70,30);
Handle(AIS_Shape) AISBottle=new AIS_Shape(aBottle);
AISBottle->SetMaterial(Graphic3d_NOM_GOLD);
mContext->SetDisplayMode(AISBottle,1,Standard_False);
mContext->Display(AISBottle, Standard_False);

Kirill'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).