4
$\begingroup$

I'm considering adding a feature to the 3d-printing tools, or to the Transform menu -- whichever is more appropriate.

Background: When 3d printing, one often must rotate an object so some face(s) lie flat on the xy plane, so it'll print flat.

Present method (which works, but is a lot of steps):

  1. Select the desired face (in edit mode)

  2. Shift+Numpad7 to view it from its local Top

  3. Go to Object mode and add an Empty

  4. Check Align to view (so the empty is aligned to the top-down view of the face)

  5. Parent the object to the empty (empty becomes parent)

  6. Select the empty and clear its rotation (Alt+R)

  7. Select and unparent (Alt+P) the object, using Keep transformation

  8. Success!

Desired methods:
A. Rotating the mesh in edit mode might be satisfactory, so:

  1. Select face
  2. Hit button (Make Face Bottom?) in 3d-Printing tools, which rotates the whole mesh so that face aims down.
    • Note: Sometimes someone may want to align so this is the top or side face, so the button might be better as: Align object to face, followed by a tool option which allows a selection of: "Top, bottom, left, right"

B. Rotating the object itself might also be desired by some, instead:

  1. Select face

  2. Shift+7 to view from face's "top"

  3. Go to object mode

  4. In the transform menu, select Align object view-rotation. Tooltip: Rotates object to align the current view's rotation with an axis.(Or something more clear).

  5. Tool-options allow overriding default of -Z with: Z-, Z+, Y-, Y+, X-, X+

    • Note: Tool-options may also allow a pulldown of the available Transform orientations, defaulting to global.

The easiest and fastest implementation might be a python addition to the 3d-printing tools, but I believe it worthwhile to consider the usefulness of this feature in normal modeling, and therefore its addition to the transform menu -- this has the secondary positive effect of it working on the object instead of the mesh, thereby retaining the object's local transform orientation.

Advice, suggestions, questions, or assistance are all welcome.

$\endgroup$
  • $\begingroup$ This seems like a feature request/discussion more than a question. $\endgroup$ – iKlsR Feb 9 '16 at 5:29
3
$\begingroup$

Blender doesn't have a tool built-in to perform this operation currently.

If you would write your own tool, a method you can use to achieve this using Python.

  • Define the source vector (face normal in this case).
  • Define the destination vector (the axis vector).
  • Use the rotation between these vectors to define a 3D rotation
    (see Vector.rotation_difference).
  • Then rotate your object by this.

This example uses the normal of the first face, assumes object

import bpy
from mathutils import Matrix, Vector

obj = bpy.context.object
matrix_orig = obj.matrix_world.copy()

# for this example just pick the first face.
axis_src = matrix_orig.to_3x3() * obj.data.polygons[0].normal
# z-axis, could be any direction
axis_dst = Vector((0, 0, 1))

matrix_rotate = matrix_orig.to_3x3()
matrix_rotate = matrix_rotate * axis_src.rotation_difference(axis_dst).to_matrix()
matrix_translation = Matrix.Translation(matrix_orig.to_translation())

obj.matrix_world = matrix_translation * matrix_rotate.to_4x4()
$\endgroup$
  • $\begingroup$ what is matrix_prev here? $\endgroup$ – Noidea Sep 23 '16 at 10:52
  • $\begingroup$ Corrected (matrix_orig) $\endgroup$ – ideasman42 Sep 23 '16 at 10:57
2
$\begingroup$

My addon, Mesh Align Plus, can do this (and many other things):

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.