I have 3 plank forming an equilateral triangle, I want to rotate them according to the triangle gravity center (where all the height intersect).
By hand I select them all, Shift+D, Enter, R, Shift+Z, turn the mouse, press Enter and voila, perfectly rotated.
I then wrote a script that does the exact same thing, however they are not rotated the same, the center of the second triangle is off.
def select_all(): scn = bpy.context.scene print("deselecting all") bpy.ops.object.select_all(action='DESELECT') objs = [obj for obj in scn.objects if obj.name.startswith("plank")] for obj in objs: print("selecting object " + obj.name) obj.select = True select_all() bpy.ops.object.duplicate() bpy.ops.transform.rotate(value=radians(180.0), axis=(0, 0, 1))
and here is an image of the results :
Why isn't the rotation being the same?