Search code examples
blender

what is the specific function of parameter value in bpy.ops.transform.rotate phyton script in blender?


i'm trying to make the object parallel to the z - axis by using bpy.ops.transform.rotate(value=90.0, axis=(1,0,0)) but all i got is this

enter image description here

import bpy


ungu = bpy.data.materials.new('Ungu')
ungu.diffuse_color=(0.6,0.1,0.3)

for i in range (5) :
x = i*2
y = 0
z = 0

bpy.ops.mesh.primitive_plane_add(location=(x,y,z))

ob=bpy.context.object
ob.name='PLANE'
mymesh=ob.data
ob.scale=((0.5,3,2))

#aplikasikan warna ungu ke objek mesh
mymesh.materials.append(ungu)
bpy.ops.transform.rotate(value=90.0, axis=(1,0,0))

so what number should i put in value parameter?


Solution

  • the value argument should be in radians but you are using degrees. I am not sure which version of Blender you are using, but acording to docs for Blender 2.82a https://docs.blender.org/api/current/bpy.ops.transform.html the transform function should be called like this:

    bpy.ops.transform.rotate(value=3.14/2, orient_axis='X')