Script to align objects to a face and line on that face

I see. But since I don’t use it for that, it will be hard to design/debug code for such a purpose. Feel free to add it to the script though, and I can upload the new version.

Hello,

When enabling the addon with Blender 2.66, there is an error:

  File "D:\Program Files\Blender Foundation\Blender\2.66\scripts\addons\space_vi
ew3d_precise_align10.py", line 185, in <module>
    class AlignUi(bpy.types.Panel):
  File "D:\Program Files\Blender Foundation\Blender\2.66\scripts\addons\space_vi
ew3d_precise_align10.py", line 202, in AlignUi
    bpy.context.scene['axis_normal_dropdown_prop'] = 2
AttributeError: '_RestrictContext' object has no attribute 'scene'

This is because if some API change:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Addons#Restricted_Context

Could you please update the addon?

Thanks.

SwapOriginIndex is a switch statement that basically adds one and loops on some number. This can be written as:
self.origin_index = (index + 1) % 3

instead of the switch. %3 is the remainder after division by 3, which means the valid values are 0, 1, 2.
x % y == x if x < y
3 % 3 == 0
4 % 3 == 1

I just want to say thank you for this mega-useful script :RocknRoll::yes:

Nice script! I was wondering if there is a way to update it to allow the orientation on the armature bones in Pose Mode to be changed. Like how you can change the local orientation of an object, I would love to change the local orientation of an armature bone to make it reset 0 rotation without changing the actual bone rotation for rigging and animation purposes.

This is an amazing script, but it could use a few usability improvements:

  • You should be able to select the current transform orientation as the source (even with this script, I still have to create a new object and align it to the current transform, and then precise align those two objects… so it would be nice to be able to skip that step).

  • You should be able to limit both position and rotation to X, Y or Z axises, and even invert them, because sometimes you want to create a partial or mirrored align.

I was planning on trying to decipher enough Python to do this myself, but I don’t know when I will find the time.