I am getting started with the Blender Python API and there is something I do not understand. Lets say I have an object called "myObject" and I wanted to get its dimensions, then I type


in the python console and get the result. The API http://www.blender.org/documentation/blender_python_api_2_71_release/bpy.types.Object.html#bpy.types.Object states, that an object also has a bound_box. But if I type


simply the command I typed is returned! Why is that and how could I have known from the doc of the API? Also, when I type


it only returns "false". Why? If I go to the object properties panel and click "Bound" the bounding box is drawn. Why does that work and doing the same (?) via the console does not?

Thank you!

  • $\begingroup$ Ah, I figured out that one simply has to set show_bounds to True to be able to see the bounding box of an object. However, I have still not figured out how to see the values of the bounding box $\endgroup$ – user1809923 Jul 15 '14 at 11:50

Object.bound_box does not contain mathutils-types like Matrix or Vector, it's a plain property array of float[3] which has no representation format like other types do.

You need to iterate over all elements and print them, e.g.:

for b in bpy.context.object.bound_box:

# (-1.0, -1.0, -1.0)
# (-1.0, -1.0, 1.0)
# (-1.0, 1.0, 1.0)
# (-1.0, 1.0, -1.0)
# (1.0, -1.0, -1.0)
# (1.0, -1.0, 1.0)
# (1.0, 1.0, 1.0)
# (1.0, 1.0, -1.0)

Or make a list of Vector objects:

[Vector(b) for b in bpy.context.object.bound_box]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.