bound_box error

Hello to all.
I’m trying to get the bound_box of a plane, and all goes well while I would not change the dimensions to it, because the change still gives me the same bound_box
What can I do? :eyebrowlift2:
Thanks in advance.

bound_box is a read only attribute.
http://www.blender.org/documentation/blender_python_api_2_56_2/bpy.types.Object.html#bpy.types.Object.bound_box

Yes, I know that bound_box is a read only attribute, but when the object changes its size, should not also change the bound_box? :confused:
Thanks.

sometimes you need to do a bpy.context.scene.update(), maybe ?

Post a short script describing what isn’t working, you’ll probably figure it out yourself.

for example, with this script:

import bpy
bpy.context.scene.update()
a = bpy.context.active_object.bound_box
for [x,y,z] in a:
print(x,y,z)

the bound_box matrix not change with 2x2 plane or 10x10 plane
what happens?

you should apply the scale transformation to the mesh…

Or just use the dimensions of the object, not the bounding box.


import bpy

bpy.context.scene.update()
x = bpy.context.active_object.dimensions[0]
y = bpy.context.active_object.dimensions[1]
z = bpy.context.active_object.dimensions[2]

print(x,y,z)

my friend I saw that I have only solution, use dimensions, because for using bound_box transformations to object will be execute in edit mode

hehe Atom! or


x, y, z = bpy.context.active_object.dimensions