bpy.ops doesn't want to move faces along their normal?

It’s a small error… or weirdness… I’m just starting to experiment with bpy.ops and straight away run into this problem.

I’m doing this:

bpy.ops.transform.translate(value=(0, 0, 1.0), constraint_axis=(False, False, True), constraint_orientation='NORMAL')

And well… it moves along the “Global” z axis, not the “normal”… It says “GLOBAL” in the info window as well…

Am I doing something wrong? I’d really appreciate a little help.

I did a move of a face along the normal and I had this in the info window:

bpy.ops.transform.translate(value=(0.178468, -0.0281915, 0.228423), constraint_axis=(False, False, True), constraint_orientation=‘NORMAL’, mirror=False, proportional=‘DISABLED’, proportional_edit_falloff=‘SMOOTH’, proportional_size=1, snap=False, snap_target=‘CLOSEST’, snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

I think looking at your code your problem is the value (0,0,1) that is not the way the operator works, look the values it said to me in my code above. It seems the vector of moving is always in world space. I agree it would be immensely easy if they change it to work as your code.

Right, I can see how that makes sense.

It’s not that useful though. It’d be much nicer if we could just say “move 1 unit” along the “normal z axis”… which is how we do it in the interface as well. And I thought bpy.ops was supposed to do “interface style stuff”…

I’ll have to poke cam when he’s back from his holidays I guess…

Actually… after doing more tests… if I use my code, in the info window it prints out the translate values properly, but has the “constraint_orientation” as “GLOBAL” so I think even if you are correct about the way it’s “supposed” to work… there’s still a bug.

then report his a a bug and it might be corrected fast before 2.56!
happy 2.5

I did exactly that :wink:

ok,

Well it took me a long while, and Ton even had a look for me… apparently it’s all my fault hehe

It didn’t work because it only works if you run this stuff inside the 3d view… not from the console or the text editor! Which I personally think is really crap…

So the only way to use bpy.ops properly is to run it for instance as an addon… eh… yeah… so… there ya go.

You should be able to put your script sequence into a text block in the Text Editor and invoke it with ALT-P.

Ido, not if you’re using bpy.ops… the text editor is then the wrong context… it might do something, but not what you want if you want anything other than the default settings.

I think that console and text editor would be better don’t be part of the context. It would be much easier try things that just now don’t work because the context is the console or the text window.

Bao2—good point. But remember the console and text editor are also scriptable, just like every other part of Blender, so they cannot be treated specially without introducing further complications.