Remove topods_shape


I want to remove a TopoDs_Shape but I can't.
the topods_shape is displayed in the myAISContext.
There is any one how know how I can remove a topoDS_Shape.


Dennis G.'s picture

You can try the following:

[code -----------------------------------------------------]
TopoDS_Shape delShp = ... // the Shape you want to delete
Handle(AIS_InteractiveContext) theIC = ... // your interactive context
AIS_ListOfInteractive ioList; // list of displayed objects
theIC->DisplayedObjects(ioList, 0); // fill list
for(AIS_ListIteratorOfListOfInteractive it(ioList); it.More(); it.Next())
AIS_InteractiveObject curIO(it.Value());
Handle(AIS_Shape) aisShp = Handle(AIS_Shape)::DownCast(curIO);
TopoDS_Shape curShp = aisShp->Shape();
[\code -----------------------------------------------------]

There might be better ways to achieve your goal, but I'm not aware of it. I haven't tested the above code. Hope it works anyway.

Good luck,


oumaia's picture

Thank you Dennis but it doesn't work:
The following error appears:

error C2259: 'AIS_InteractiveObject': can not instantiate an abstract class
1> due to following members:
1> 'void SelectMgr_SelectableObject: ComputeSelection (const Handle_SelectMgr_Selection &, const Standard_Integer)': is abstract
1> c: \ opencascade6.3.0 \ ros \ inc \ selectmgr_selectableobject.hxx (199): see declaration of 'SelectMgr_SelectableObject: ComputeSelection'

this error is caused by this line: AIS_InteractiveObject curIO(it.Value());