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.

Custom axis UI

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
  • $\begingroup$ Thank you, lemon. So i need z=m*Vector((0, 0, 1)) as axis for bpy.ops.mesh.spin(axis=z) $\endgroup$ – Yurii Sivalnev Apr 11 '17 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.