Hi,
How do you reference OBB (oriented bounding-box) to Grasshopper, Python or C# editor?
It is always casted to World aligned Bounding Box:
Hi,
How do you reference OBB (oriented bounding-box) to Grasshopper, Python or C# editor?
It is always casted to World aligned Bounding Box:
See also this previous discussion:
You didnât post any code?
Do you have the OOB plane?
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_GeometryBase_GetBoundingBox.htm
This recent thread was about finding minimal bounding box but only considered rotation of âWorld XYâ about its Z axis. Your geometry needs more than that.
Sorry, I think I did not describe the problem correctly.
If I try to input to C# component a Brep that looks like a box as a Box type.
The brep boundingbox is computed, instead of casting it to a Box type.
Is there a way to cast Brep to Box type that remains the OBB?
Hi Petras,
Check out this topic of mine:
I believe you have encountered a similar problem.
Box worldXY_bbox;
BoundingBox pln_bbox = srf[i].GetBoundingBox(pln, out worldXY_bbox);
double ar = worldXY_bbox.Area;
if(ar < area){
area = ar;
nb[i] = worldXY_bbox;
}
Thanks, this suggested me the right solution:
Box x = Box.Unset;
Plane xPlane = Plane.Unset;
bx.Surfaces[0].FrameAt(0, 0, out xPlane);
bx.GetBoundingBox(xPlane, out x);
I wish there would be a direct casting, but this works.
Thank you;)
That C# code was from Riccardo (@maje90) in the thread I mentioned earlier. It was part of a âParallel.For()â loop to speed up the search for OBB. In the âC# V4â cyan group, BBoxV5_Aug1a.gh
Nice work, good thread. Makes C# interesting.