# How do I orientate an object exactly flat to a plane?

I am building a turtle. With some boolean operators I'm cutting the plates on the back. I have to do this in place (round surface) especially because of boolean interaction. Now I need the shields/plates alone, lying on the ground. So I duplicate the shield-object, apply all modifiers, and seperate all plates by "loose parts". But now they are hanging skewed in space. How can I align them exactly(!) to the ground? (I'm doing it now by manually rotating in very hig resolution, but it allways remaines eye balled.)

Solved!!    @Xtremity Sorry, I didn't read carefully enough first!

The clue was to go in edit mode, and select a FACE, not the object! Now it works like charm! (Though a bit complicated, so I'll try to write (or find) a macro, as you told, because I'll have to do it many times.)

• do you just want them to sit flush with z=0 or sit flush and be rigtly oriented in the xy plane? – lineage Apr 28 at 21:06
• I don't care the orientation. I just want to have them flat on the floor. Z=0 for the whole lower plane. – Aquaball Apr 28 at 22:29
• blender.stackexchange.com/questions/539/… Think this is useful if you simply try to stick them to a flat plane. – J_M Apr 28 at 22:51
• – Jachym Michal Apr 29 at 8:17
• @Aquaball can you please post the file anyways..I would like to find out why simple rotation correction didn't work – lineage Apr 29 at 18:28

This is where it would be handy to have Maya's Bake Pivot Orientation command. Sadly, I haven't been able to find a straightforward way to do this. The best method I have come up with so far is as follows:

1. Set the mesh object's Origin to Geometry.
2. Create a custom Transform Orientation for the face you want to be considered 'up'
3. Create an Empty at the object's origin
4. With the Empty selected, use Object, Transform, Align to Transform Orientation
5. Parent the mesh object to the Empty
6. With the Empty selected, use Object, Clear, Rotation. The mesh object's orientation will now be reset to 'normal'
7. Optionally, you can apply the rotation transform on the mesh object.
• "would be handy to have Maya's Bake Pivot Orientation" -- You might find it a little handy to join your mesh object to a different mesh object to acquire its orientation. A little simpler (although there are times it's a bad idea.) – Nathan Apr 29 at 21:30

Just an idea, doesn't work, missing a lot. Maybe I'll try some day.

# manually select: Platte
bpy.ops.object.editmode_toggle()
# manually: Select corresponding Face
bpy.ops.transform.create_orientation(use=True)
bpy.ops.object.editmode_toggle()

bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
bpy.ops.view3d.snap_cursor_to_active()

# Insert Null
bpy.ops.object.empty_add(type='PLAIN_AXES', location=(1.38602, -4.99301, 0.856578))  # = plate.origin
bpy.ops.transform.transform(mode='ALIGN', value=(0, 0, 0, 0), orient_axis='Z', orient_type='VIEW',
orient_matrix=((0, 1, 0), (0, -0, -1), (1, -0, 0)),
orient_matrix_type='VIEW', mirror=True, use_proportional_edit=False,
proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False,
use_proportional_projected=False)
# manually: select: Object + Null
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)
# manually: select: Null only
bpy.ops.object.rotation_clear(clear_delta=False)
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.ops.object.delete(use_global=False, confirm=False)
# manually: delete temp orientation system


That's all. Missing: select object (by name?), brake to select face, name and reselect Null, delete temp orientation, loop all objects in collection, ...