RhinoCommon - plane aligned boundingbox?

HI all,

Having a brain fart here - I have some RhinoCommon geometry (curves, surfaces that are not in the document), and I need to get a plane-aligned bounding box for each with a plane that is not one of the principal XYZ planes. I need to do this a lot of times.

I have tried with

xform = Rhino.Geometry.Transform.ChangeBasis(Rhino.Geometry.Plane.WorldXY, ref_plane)
#and then
bb=obj.GetBoundingBox(xform) #one single object here

then getting the corner points and transforming them in the other direction, but this still seems to get me a world-aligned bounding box…

bb=obj.GetBoundingBox(ref_plane)

Didn’t work either…

Thx, --Mitch

Hi Mitch,

On my phone but iirc I recently tackled it like so:

geometry.GetBoundingbox (plane).
This gets the plane aligned bbox.

Next create an xform rotation from worldXY to plane

Make a Box from the boundingbox :
Rhino.Geometry.Box(Boundingbox)

and transform that Box with the xform

http://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_GeometryBase_GetBoundingBox.htm

http://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_Box.htm

HTH
-Willem

1 Like

Thanks Willem! I have to get off this project now, but I will get back to it later… --Mitch

1 Like

Hello. I think the whole trick is to realize you are getting a plane aligned boundingBox and this box is defined by coordinates for the Min/Max corners. Now the coordinates are in the plane space so if you want to materialize the box use Rhino.Geometry.Box(plane, boundingBox) where plane is your plane and bounding box your plane aligned boundingBox.

Yep, simply I did not read the help carefully enough and assumed it returned the plane-aligned bounding box but in world coordinates - my bad.