Rhino newbie here. Is there an inbuilt option in rhino to generate individual bounding boxes for each object within a selection or a group? If not, is there a Rhino or Python script for the same?
No, there is not. In Grasshopper, the BoundingBox component can be set to create individual boxes or one global box. Otherwise, below is a simple python script to do create one world-aligned volume bounding box for each object (if possible). It will ignore objects for which it cannot create a valid 3d box - points, lines or planar curves parallel to one of the world planes, etc. Let me know if you need something more sophisticated…
AddWBBForEachSimple.py (356 Bytes)
Thank you very much for the info and script. However, it just creates a single overall bounding box for all the objects combined. The objects here are meshes.
That’s not possible… unless the mesh objects have been joined into one single object (disjoint mesh).
I did notice a typo in the script call however, the last line is wrong - which wouldn’t change how the script works, just that it wouldn’t run at all… I will correct it above, you can re-download it from the same link.
If it still makes one big box, please post a small file so I can test.
Thank you very much.
I just checked and it works. It doesn’t provide an option to generate the output as curves. Should there be script level changes to achieve this?
Are you looking to have the output as wireframe and not surfaces/solids? Or are you looking to have rectangles generated for planar curves that lie in one of the principal planes?
Edit: OK, just for fun, I put together a more complete function. If objects are not preselected, there are command line options to create either World or Cplane aligned bounding boxes, and attribute the original objects characteristics (layer, color, name, etc.) to the bounding box or not. The options are sticky within the same Rhino session.
Planar curves parallel to the chosen plane are special cased into outputting plane-aligned bounding rectangles. Objects from which neither a valid 3d box nor 2d rectangle can be made are ignored.
Let me know how this one works.
AddBBForEach.py (3.7 KB)
I added a youtrack request for the BoundingBox command to be “augmented” with the ability to create individual boxes…
Thank you very much.
@Helvetosaur you are the best. Thank you for this.