Search code examples
geometryopencascade

Get TopoDS_Shape from AIS_InteractiveObject


I'm very new to OPEN CASCADE. Can someone please let me know how to get the shape from AIS_InteractiveObject which used to view the shapes. Thanks.

There are no direct functions to get the shapes. I checked with the class discription in Open CASCADE documentation.


Solution

  • Let's say you have your AIS_InteractiveObject called "interactiveObj". You can downcast this to "AIS_Shape" first.

    interactiveObj = ... ; // your interactive object
    Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast(interactiveObj ); // convert to AIS_Shape
    

    Then you can get the TopoDS_Shape from the object.

    TopoDS_Shape shape = aisShape->Shape();
    

    This is the simple method.

    TopoDS_Shape shape = Handle(AIS_Shape)::DownCast(interactiveObj)->Shape(); // get the TopoDS_Shape