# calculating bounding box center coordinates

Well, the title says it all…
I need that. This is especially important when dealing with objects whose origin is out of the mesh.
Thanks in advance to everybody!!!

what do you want to do with this data ?

is the center good enough ?

mport bpy
ob = bpy.context.object

print(“Obj:%s bounding box coords”%ob.name)
for [x,y,z] in ob.bound_box:
print(x,y,z)

salutation

Hi there!

If you need to find the bounding box centre, then this code should work.

``````
import bpy
from mathutils import Vector

ob = bpy.context.active_object

centre = sum((Vector(b) for b in ob.bound_box), Vector())
centre /= 8

print(centre)
``````

If you’d like any extra information, let me know. Hope that helps.

Cheers,
Truman

2 Likes

@TrumanBlending: eyeopener ob.bound_box contains float(3) objects (Bl 2.63)

Thanks very much for your precious contribution.

Now I know someting more…

Thanks!!

I am surprised that no one asked you why you divide everything by 8, so i am going to. Why?