# Set axis for spin from custom orientation

I want create custom operator, which will replace bpy.ops.mesh.spin() Instead of taking rotation axis from view, i want to take it from custom axis orientation.

I know how to get matrix for it:

m = bpy.context.scene.orientations[0].matrix


but need to know how to get this axis information

From m = bpy.context.scene.orientations[0].matrix

Transformed X, Y and Z axis (in world coordinates) are:

x = m * Vector( (1, 0, 0) )
Y = m * Vector( (0, 1, 0) )
z = m * Vector( (0, 0, 1) )


If you need it in an object local coordinates:

x_local = obj.matrix_world.inverted() * x
y_local = obj.matrix_world.inverted() * y
z_local = obj.matrix_world.inverted() * z

• Thank you, lemon. So i need z=m*Vector((0, 0, 1)) as axis for bpy.ops.mesh.spin(axis=z) – Yurii Sivalnev Apr 11 '17 at 13:01