Bouding Box for Each Selected Group

Hi everyone,

I am working with multiple models on the same file composed of many individual parts.

I was wondering if there was a way to automatically generate an individual bounding box for each selected group. And by this I mean the higher level group, as sometimes there can be a group within a group.

Thanks in advance,
Shynn

If you are using the Rhino command, you can use BoundingBox.If you are using Python,like this
#coding =utf-8

import Rhino.Geometry as rg
import rhinoscriptsyntax as rs
import scriptcontext as sc

objects = rs.GetObjects("Pick a group")
if(objects):
    boundingbox = rs.BoundingBox(objects)
    box = rs.AddBox(boundingbox)
    sc.doc.Views.Redraw()

You mean something like this:

import rhinoscriptsyntax as rs
import Rhino
groupTable =  Rhino.RhinoDoc.ActiveDoc.Groups.GroupNames(True)
selectedGroupNames = Rhino.UI.Dialogs.ShowMultiListBox("Select as many group as you like", "Select Group", groupTable, None)

for name in selectedGroupNames:
    index = Rhino.RhinoDoc.ActiveDoc.Groups.Find(name)
    objects = Rhino.RhinoDoc.ActiveDoc.Groups.GroupMembers(index)
    ids = []
    for obj in objects:
        ids.append(obj.Id)
    rs.AddBox(rs.BoundingBox(ids))

ShynnSup.py (495 Bytes)