How to get the TopoDS_Shape from a existing AIS_Shape?

I already have a AIS_Shape which is moving a little every 100ms.I need to get the location of the changed AIS_Shape in TopoDS_Shape to do the BRepAlgoAPI_Cut() function.
So,how can I get the TopoDS_Shape from a existing AIS_Shape?

heXus's picture

Please, look at this code. You need use "DownCast".

void MyDoc::ModifyFillet()
{
if( !myAISContext->HasOpenedContext())
{
wxMessageBox(_T("It is necessary to activate the edges selection mode\n\and select edges on an object before \nrunning this function"),_T("Error!"));
return;
}

myAISContext->InitSelected();
if (myAISContext->MoreSelected()) {
Handle(AIS_Shape) S = Handle(AIS_Shape)::DownCast(myAISContext->SelectedInteractive());

if (S.IsNull()){
wxMessageBox(_T("It is necessary to activate the edges selection mode\n\and select edges on an object before \nrunning this function"),_T("Error!"));
return;
}

TopoDS_Shape Sh=S->Shape();

BRepFilletAPI_MakeFillet aFillet(Sh);
}