How do I find the smallest possible bounding box for a solid?

Is there an easy method in Rhino and/or Grasshopper to find the smallest possible bounding box for a solid?

My application is for CNC carving. I’d like to be able to quickly find out the minimum size stock, particularly thickness, needed for objects, often many objects.

Currently I figure this out by manually rotating parts and eyeballing how close they are to being as flat as possible relative to each cplane in each 2d view port.

Surely there’s a better way?

Here’s also a full topic dedicated to different solutions with some nice speed comparisons by @RIL

2 Likes

I have script for orienting brep/solid in such a way that its bounding box has minimum “Z-height” - it is useful for 3D printing (on SolidScape printers) since in most cases this will reduce printing time.
Since you need minimum bounding box (minimum diagonal) I added few lines of code to find position (by rotating it around Z-axis) where resulting box will be minimum.
Result is approximate based on incremental angle (number of steps per 180degree, 180 steps will give us incremental angle of 1 degree)…
MinimumBB.gh (28.7 KB)

2 Likes

Thanks!

Actually, I’d love the original version. Thickness is my primary concern too. I CNC carve stuff out of slabs of foam and wood.

It seems like the other definitions and scripts above tend to produce boxes that find something close to minimum Z thickness, but not exactly and not always.

The script should always return brep oriented in a such way that it has minimum “Z-thickness” (with respect to number of steps by which we dived angle of 180 degree, 180 steps should work ok).
Or you have some solids where the script is not working correctly (not orienting brep in Minimum-Z manner)?

Haven’t tried yours yet. I was talking about links above. One of them has three different GH definitions that produce somewhat variable results. Thickness differences of about 5% between them.

1 Like

Hi,
Is possible to modify your C# code and replace the Brep entry with a mesh one?
Thanks

Here is version where input object can be any geometry type
MinimumBB-2.gh (13.4 KB)

3 Likes

Nice. I modified a little bit your definition to work also with closed curves.

MinimumBB-3.gh (17.4 KB)

3 Likes

This is really useful! Thanks.
A nice addition would be an output that is the applied Translation, T, so this could be used on other associated objects.

I’ll be trying this out soon. Thanks!