Add TopoDS_Shape in AIS interactive context

Hello. I have vector of TopoDS_Shape /  How can I load this shapes into AIS interactive context to display them? 

I tried to do next:

for (auto &shape : copy) {

gp_Trsf trsf;

trsf.SetTranslation(gp_Vec(100., 0., 0.));


Handle_AIS_InteractiveObject obj;

Handle_AIS_Shape anIS = Handle_AIS_Shape::DownCast(obj);


myAISContext->Load(obj, Standard_True);



But I have an error in      anIS->Set(shape);

May be you know a way to convert TopoDS_Shape into AIS_InteractiveObject

Hugues Delorme's picture


you don't create the AIS object, do something like this instead :

Handle_AIS_Shape aisShape = new AIS_Shape(shape);
aisContext->Display(aisShape, true);
a.kliuchnikova_144191's picture

Thank you! It works!