I want to create bounding box in modeling using Bnd_Box Class.

I want to create a bounding box for a created shape box. Below is the basic code attached.

void MakeBox()
    {

        BRepPrimAPI_MakeBox abox(1, 1, 1);
        TopoDS_Solid aShape = abox.Solid();

        Bnd_Box box;
        BRepBndLib::Add(aShape, box);
        Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
        box.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);

        Handle(AIS_Shape) aShapePrs = new AIS_Shape(aShape); // creation of the presentable object
        myAISContext()->Display(aShapePrs, AIS_Shaded, 0, true);   // display the presentable object and redraw 3d viewer
        FitAll();

    }
gkv311 n's picture

So, you have created the Bnd_Box from your shape. What doesn't work?

john ko's picture

I want to print it out on the screen.

gkv311 n's picture

As highlighting style of AIS_Shape (see Aspect_TOHM_BOUNDBOX or AIS_Shape::SetHilightMode(2)) or as a dedicated interactive object?

Lahiru Dilshan's picture

It seems you need to display the shape in the viewer. Is that right?