Finding an object center

using VBscript, how can I find an object’s center similar to Gumball. I can’t seem to find a command or group of commands that will do this.

For the Gumball, the object’s center is the center of its bounding box. So you could write a custom function to get an object’s bounding box center something like this:

Private Function BBCtr(obj)
    Dim arrBB
    If IsArray(arrBB) Then
    End If    
End Function


1 Like

If you don’t wanna mess with Rhino.BoundingBox, there’s:


Curve Area Centroid is bugged though. Sometimes it will fail for no apparent reason.

Yes. However, if you are trying to get the same center as Gumball, only the bounding box is guaranteed.

Interesting! Why wouldn’t they match in this example though (assuming it’s a rectangular box with box cutout)?..

Because the volume centroid is a mean (average) of all the enclosed volume space - which is naturally weighted towards the lower left rear in this case - whereas the bounding box center does not take into account the object’s shape, volume or other characteristics, just its overall size relative to the world or local CPlane.


Hi Mitch,

Thanks for your help.
Just what I needed.

Hi Asterisk,

Thanks for your help.

Mitch’s suggestion matches more closely what I needed.

Still learned much from your help.