IronPython "GeometryBase" for Brep.GetBoundingBox()-Method...convert Brep-List into IEnumerable

Hi all,
I tried to get a bounding box of some breps with “Rhino.Geometry.Brep.GetBoundingBox(self: GeometryBase, plane: Plane)”.
My Problem is, that “GeometryBase” is an .NET-style IEnumerable (“System.Collections.Generic.IEnumerable”) argument…

How can I cast a pythonic list with guid’s of breps into an IEnumerable, so that it fits as a

I got no Idea of C# and .NET…

Thanks a lot

Mr Sinter

Not sure exactly what you’re trying to do, but to get a combined bounding box of several Breps, you need to get the bounding box of each and then use BoundingBox.Union(boxA,boxB) to succesively union all the boxes together. As far as I know, you cannot use Brep.GetBoundingBox() with a list of Breps, only one at a time…


Hi Mitch,
I have several Breps from an extruded planar text.
I want to create a plate under the text, so I as my text input is varying in size, i need a dynamically fitting bounding box to those text breps…My Problem is, that I dont know how to cast my brep guid’s into that “GeometryBase” argument, which has that “IEnumerable”-style, which has something to do with Rhino’s underlying .NET-functions…

Here a code snippet:

brep_list = List[]
brep_extrude = rhi.Geometry.BrepFace.CreateExtrusion(brep_face, path_curve, True)
#Now I want to get a bounding box around all brep elements in my brep_list
bounding_box = rhi.Geometry.Brep.GetBoundingBox(self: GeometryBase, plane: Plane)
#How to cast brep_list into GeometryBase?

As I said, one by one… you can’t pass a list to Brep.GetBoundingBox(), only a single Brep. Then you need to “union” all the bounding boxes. Hang on, I’ll try to hack together an example.

Edit: here is a quick sample hack:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

objIDs=rs.GetObjects("Select some brep objects",8+16,preselect=True)
brep_list=[sc.doc.Objects.Find(objID).Geometry for objID in objIDs]
bbs=[brep.GetBoundingBox(True) for brep in brep_list]
if len(bbs)>0:
    for i in range (1,len(bbs)): ubox.Union(bbs[i])
1 Like

Thanks a lot…I will also try to generate a boundingbox automatically with Grasshopper…

Mr Sinter

Hi all,
I found in a script this method rh.Geometry.Brep.GetBoundingBox (), I would like to understand it, but I did not find it in the help (Grasshopper/Rhino Python script Editor).

Could you explain to me how I can find the explication of this method in the help, for example in Grasshopper/Rhino Python script Editor?

I thank you very much

You might look in the RhinoCommon API help.

– Dale