Update object transformation in script

Hello all,

I’m trying to make a Python script that make some calculations according to the objects position (actually it’s angle of rotation) at the scene. In this script I have a loop that increments the objects angle by some step value and for each iteration it performs the calculations and prints the result.

The problem is that when I run the script only the initial angle are considered, it seems the angle increments are not computated.

For example:


current_obj = bpy.data.objects['Cube']
for ang in range(80,100):
    ang_r = (ang*math.pi)/180
    current_obj.rotation_euler = mathutils.Euler((0,ang_r,0),'XYZ')

    mtx = current_obj.matrix_world
    #calculations

The code above seems to not update the “current_obj.rotation_euler” until it finishes, it does not update it while executing the loop. Is there any restriction on updating objects properties inside a loop on scripts?

I suspect I’m doing something silly here, but I’ll need someone’s help, because I’m very new to Blender yet.
I’m using Blender 2.61.

Thanks for the attention.

Have a look at

http://www.blender.org/documentation/blender_python_api_2_62_release/info_gotcha.html#can-i-redraw-during-the-script