Forum archiveIssue archiveVisualization and 3D Viewer

Archived discussion

Add TopoDS_Shape in AIS interactive context

Visualization and 3D ViewerWed, 01/16/2019 - 09:152 replies

Browse this forum
QuestionAuthor

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

shape.Location(TopLoc_Location(trsf));

Handle_AIS_InteractiveObject obj;

Handle_AIS_Shape anIS = Handle_AIS_Shape::DownCast(obj);

anIS->Set(shape);

myAISContext->Load(obj, Standard_True);

myAISContext->SelectedInteractive()->Redisplay(true);

}

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

May be you know a way to convert TopoDS_Shape into AIS_InteractiveObject

Discussion

2 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hello,

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

Handle_AIS_Shape aisShape = new AIS_Shape(shape);
aisContext->Display(aisShape, true);
02Author

Thank you! It works!