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)
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…
Didn’t work either…
On my phone but iirc I recently tackled it like so:
This gets the plane aligned bbox.
Next create an xform rotation from worldXY to plane
Make a Box from the boundingbox :
and transform that Box with the xform
Thanks Willem! I have to get off this project now, but I will get back to it later… --Mitch
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.