16
$\begingroup$

How can I align object edge to one of the axis? For example, if I have a cube rotated 'freely' in the scene with applied rotation -- how can I realign it along x y and z axes again?

using physics engine comes to mind, but it also sounds like an overkill

$\endgroup$
  • $\begingroup$ Do you mean the objects origins? Or a specific vertex of the object? $\endgroup$ – CharlesL Jan 19 '14 at 0:02
  • $\begingroup$ in simplest case -- if I have an edge between two vertices -- how to align it to be parallel to one axis without changing shape of the object $\endgroup$ – dimus Jan 19 '14 at 0:05
  • $\begingroup$ You might be able to snap it to the surface of another aligned object, but I'm not sure. $\endgroup$ – gandalf3 Jan 19 '14 at 0:49
  • $\begingroup$ See also: youtube.com/watch?v=NEUa1IA7NBQ $\endgroup$ – Dave Jarvis Apr 10 '15 at 20:30
18
$\begingroup$

I think you can do it by tricks like parenting, constraint, snapping, addon, and scripting.


Method 1 (parenting):

  1. Select the edge you want to align;
  2. ShiftNumpad 7 to align view to selected edge;
  3. ShiftS > Cursor to Selected;
  4. Switch to Object mode, ShiftA to add an empty, F6, toggle Align to View, set it as parent to that object;
  5. Select the empty, AltR;
  6. Select your object, AltP > Clear and Keep Transformation. Then delete the empty.

Method 2 (constraint):

  1. (as method 1)
  2. (as method 1)
  3. (as method 1)
  4. (as method 1)
  5. Add another empty, add a Copy Rotation constraint to it, select the first empty as Target, leave other settings as default;
  6. CtrlA > Apply visual Transform, then delete the other two empties.

Method 3 (snapping):

  1. Select one vertex on the edge you want to align;
  2. ShiftS > Cursor to Selected;
  3. Switch to Object mode, ShiftA to add a new empty, then move it for a certain distance along the expected axis;
  4. Select all vertices of your object in Edit mode, with another vertex on that edge active (NOT the one in Step 1). Enable Snap mode on 3D View header, set Snap Element to Vertex, and make sure the Snap Target is set to Active;
  5. CtrlAltQ to toggle Quad View, switch Pivot Point to 3D Cursor, snap the active vertex to the empty in two of the three Ortho views individually (it may depends on the actual case). Then delete that empty.

Method 4 (addon):

Luckily there is an addon called Precise Align (the latest version is 1.1), which can well handle this:

  1. Select one face that includes the edge you want to align;
  2. Find Precise Align tool panel in the toolbar, click Create Empty button, click Swap Empty Origin if it is not aligned with the expected edge. Make sure Parent to Object is toggled;
  3. Back to Object mode, select that empty, AltR;
  4. Select your object, AltP > Clear and Keep Transformation. Then delete the empty.

Method 5 (scripting):

Actually, I'm not good at scripting, but I'm sure it can be done. Welcome anyone that can complement with the scripting solution here. :)

$\endgroup$
  • 1
    $\begingroup$ item 4 "set it as parent to that object", how? $\endgroup$ – AaA Mar 25 '15 at 16:07
  • 1
    $\begingroup$ @AaA To parent the object to empty, first select the mesh object (Child), then select the empty (Parent) while holding Shift, then Ctrl P. $\endgroup$ – Leon Cheung Mar 26 '15 at 2:57

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.