C++ boundingbox - how to get tight?

Today I was trying something I thought would be super simple. Draw a sphere, select it with a command, get the BREP and get its bounding box from C++ code.

I tried .BoundingBox(), .GetBoundingBox(…), .GetBBox(…) an .GetTightBoundingBox(…). None gave a true bounding box for spheres that were not centered to the origin.

Are there any examples on how to do this correctly?

1 Like

Use RhinoGetTightBoundingBox. See rhinoSdkUtilities.h for more information.

Note, for Breps, tight bounding boxes are calculated from the object’s render mesh. If the object does not have a cached render mesh, one will be generated.

2 Likes

Aha! Thanks :smile:

A sample if needed:

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleBoundingBox.cpp