How to put the AIS_Shape or AIS_InteractiveObject inherited object into the TDF_Label

Hi, all,
How to put the AIS_Shape or AIS_InteractiveObject inherited object into the TDF_Label, thankx.

jack

ivan's picture

You should use the TPrsStd_AISPresentation attribute.

Jack's picture

Hi,
TPrsStd_AISPresentation has no such member function that allow me to set a AIS_Shape object into, so if I have a AIS_Trihedron object, how can I set it into the TPrsStd_AISPresentation object, If you has some idea, can you put some codes here,
thankx.
Jack

Serge's picture

Hi Jack,

It's impossible to put AIS_Shape to TPrsStd_AISPresentation attribute. To display for example a TopoDS_Shape that is in TDF_Data stored using a TNaming_NamedShape attribute place AISPresentation attribute to the same label where NamedShape was set:

TDF_Label L; //The label with NamedShape
Handle(TPrsStd_AISPresentation) Prs = TPrsStd_AISPresentation::Set(L, TNaming_NamedShape::GetID());

Prs->Display(Standard_True);

The AISPresentation attribute will create AIS_Shape and display it in the viewer. Note the viewer must have been set to a OCAF document before calling Display method.

Regards