Hi,
We are working on upgrading one of our Rhino plugins from Rhino 7 to Rhino 8. We came across this bug with extrusion objects and bounding boxes.
If you run the code below on Rhino 7 you will get a a bounding box that correctly fits the geometry. However, if you run the same code in Rhino 8, you get an incorrect bounding box that is way too big.
var rhinoDoc = RhinoDoc.ActiveDoc;
var polylineCurve = new PolylineCurve(new Polyline()
{
new(0, 0, 0),
new (3271, 1947, 0),
new (3348, 1993, 0),
new (3339, 2368, 0),
new (-7217, 2368, 0),
new (-8527, 1295, 0),
new (-5107, 0, 0),
new (0, 0, 0),
});
var extrusion = Extrusion.Create(polylineCurve, 37, true);
var localPlane = new Plane(
Point3d.Origin,
new Vector3d(0.8592956334680628, 0.5114792413214057, 0),
new Vector3d(-0.5114792413214057, 0.859295633468062, 0)
);
var grainPlane = new Plane(localPlane);
grainPlane.Rotate(5.2093745710934982, Vector3d.ZAxis);
var transform = Transform.ChangeBasis(Plane.WorldXY, localPlane);
extrusion.Transform(transform);
var id = rhinoDoc.Objects.Add(extrusion);
// extrusion = rhinoDoc.Objects.FindGeometry(id) as Extrusion;
var box = new Box(grainPlane, extrusion);
var brep = box.ToBrep();
rhinoDoc.Objects.Add(brep);
On Rhino 7 it will look like this. The bounding box is in green.
On Rhino 8 it will instead look like this.
It seems to resolve itself if you retrieve the object that was added to the rhinoDoc. You can do so by uncommenting the commented line in the code above.
I checked the breps generated by the extrusion and the second extrusion created when added to the Rhino document. Both seem identical according to GeometryBase.GeometryEquals. Our internal brep hashing code also shows that they are identical. I also tried to generate the box with Extrusion.GetBoundingBox but is has the same result.
In case it matters, this was tested on Rhino 8.19.25132.1001 and Rhino 7.27.23032.13001 on Windows.
Would anyone have any ideas on how to fix this, or find a workaround? Unfortunately for us just adding the object to Rhino is not a viable solution. Our plugin does the geometry rendering directly in the pipeline, so these objects are not added to Rhino in our case.

