How do I get a centroid of a brep using RhinoCommon?

if you need a proper volume centroid, use AreaMassProperties:

Rhino.Geometry.AreaMassProperties.Compute(x).Centroid

Or if it doesn’t have to be the centroid exactly, just a point near the center, use the faster

x.GetBoundingBox(False).PointAt(0.5,0.5,0.5)

(x is the Brep)

8 Likes