0
$\begingroup$

I'm currently writing a plugin for Blender. Everything is done except one stuff.

I would like to align an object to the selected transform orientation. Without the plugin, I just have to click on "Object"->"Transform" ->"Align to transform orientation". But I didn't find in the Blender Python API a method for doing that in a plugin.

Do you have an idea? Thanks, Maxime

$\endgroup$

1 Answer 1

1
$\begingroup$

This is "bpy.ops.transform.transform(mode='ALIGN')".

enter image description here

$\endgroup$
4
  • $\begingroup$ Thank you. In my case, I need to do this: bpy.ops.transform.transform(mode='ALIGN', constraint_orientation='my_orientation'). It's working when executing it separatly. But Blender crashed and closed when executing it in a script just after the object creation: bpy.obs.object.add(type='EMPTY') bpy.ops.transform.transform(mode='ALIGN', constraint_orientation='my_orientation'). Any ideas? $\endgroup$
    – Maxime
    Commented Mar 29, 2017 at 11:29
  • $\begingroup$ I've added an orientation (ctrl alt space) and used the script you indicate here: no crash (except bpy.ops and not .obs). $\endgroup$
    – lemon
    Commented Mar 29, 2017 at 11:34
  • $\begingroup$ Ok thanks. When I say that Blender crashes it means that the software closes by himself. Is it possible to have access to the console log history? I've to see the stacktrace to try to understand as you were not able to reproduce $\endgroup$
    – Maxime
    Commented Mar 29, 2017 at 11:37
  • $\begingroup$ You can run Blender from a dos console $\endgroup$
    – lemon
    Commented Mar 29, 2017 at 11:44

You must log in to answer this question.

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