0
$\begingroup$

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

$\endgroup$

1 Answer 1

1
$\begingroup$

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .