Align Tool

by Yain Vieyra in Scripts and Addons

Note: Blender 2.8 version of Align Tool is coming soon!









Introduction

Align Tool is an interactive addon that allows you to align objects in the 3D viewport.
It's designed to bring you flexible alignment options, taking advantage of the different geometric relations that exists between objects.

The interactive tool works in Object Mode by projecting the objects to a desired Plane, which can be oriented in any way.

In 2D applications you can normally align objects in 2 main directions fixed to the screen. In 3D space this is trickier, as not only up and down exists, but also the objects may have a particular orientation in space, and the projection may happen not only in global, but in local coordinates or some user-defined orientation.

Align Tool can project lots of objects at once, interactively as you navigate your scene and select objects. The Tool lets you preview in realtime where will objects sit after alignment.

The interactive preview allows you to use shortcuts to ease the selection of the origin point and the projection plane, all in realtime, as you see how objects get projected.

Align lots of objects at once

Transform your objects while previewing the alignments.


Workflow

You pick an Origin point, which is projected to a Plane of your choice in realtime. When confirmed, your objects are translated, which allows you to align them in any direction and to any plane of reference.

Basic example of aligning an object to another


Features

  • Align several objects at once, both as a whole or individually.
  • Move objects in realtime in the 3D view while seeing them project on the plane, or align them directly without using the interactive preview.
  • Call the tool directly from the operators search (Space key), or just use the Align Tool shortcut: Ctrl + Alt + A
  • Preview the translation of objects in the 3D view with colored arrows indicating the axis in use.
  • See the target projection plane drawn in the 3D view and colored with the axis in use.
  • Use buttons with preset alignments, to work easily in global coordinates.
  • Pick a different origin point, plane of projection and direction.
  • Choose between X, Y and Z axes independently both for the direction and projection plane.
  • Set the projection plane to the origin of the World, the Cursor, an individual object or a group of objects.
  • Use the object's location as the origin point or to define the projection plane.
  • Use the bounding boxes of objects to pick up the origin point, or to define the projection plane.
  • Selected objects have their own bounding box.
  • Pick an object outside the selection to project objects to.
  • Set the projection plane up to 3 levels of depth per axis within the bounding box.
  • Use the object's geometry to better fit the object to the plane.
  • Pick a vertex, a node or even a bone as the origin point.
  • Set the origin point to the origin of the World, the Cursor, the location of objects or some corner of the bounding boxes of objects.
  • Select the origin point and projection plane through the User Interface, or directly from the 3D view.
  • Switch between global and local space interactively when using the location of objects or their bounding boxes.
  • Cycle through all available orientations directly in the 3D view.
  • Use shortcuts in the 3D view to change aligning parameters faster and easier.
  • Draw the bounding boxes in the 3D view to better see the alignment relation between the objects and the projection plane.
  • Mesh objects are highlighted when picking an origin point or a projection plane from them.
  • Objects hierarchy is taken into account when aligning several parented objects.
  • Projections parallel to the plane are invalid and won't move the affected object. These will be highlighted in red.


Fundamentals

The Origin point










An Origin point may sit on a predefined spot, like the origin of the world, the cursor, or an individual vertex/bone/node.

The Origin point may also sit on an object's location, or a bounding box corner surrounding an object or a group of objects.

Pick the origin point interactively using shortcuts


The projection Plane







The Plane can also sit in the origin of the world, the cursor, an object or a group of objects. It may have any orientation in space and it can be set to one of the three axes of the selected orientation. Any unique orientation have a set of 3 axes associated to it.

The Plane can sit on an object's location or use its bounding box as reference. When using the bounding box, the Plane aligns to its orientation and allows you to fit it to some of its axes and to one of its available depths.

Pick the projection Plane interactively using shortcuts


The Direction of projection





The Direction in which objects are projected may have any orientation, and it can be set to one of the three axes of the selected orientation.

This Direction is independent of the Plane; that means that the Plane doesn't force you to use the same axes as theirs.

You can use the global coordinates, which is useful for normal alignments like those available in 2D applications, with the addition of the Z axis.

Select any direction for projection


When using the local coordinates, you can select between 2 kinds of Directions:

  • Use the active object's local axes for all selected objects, not taking into account the orientation of the rest of objects.
  • Use the local axes individually for each of the selected objects. This allows you to have several distinct Directions projecting to the same Plane.

Use the local axes from the active object or from every individual object in selection


The Direction of projection can also be perpendicular to the Plane. This is always one direction only, as other perpendicular directions cannot exist for a given Plane.

Use of the perpendicular to plane direction


Bounding box

The bounding box may be defined by the global coordinates, the local coordinates of objects or a perpendicular-to-plane coordinates, which is generated on the fly.

The bounding box is subdivided. This allows you to use its midpoints to set the Origin points or the projection Plane.

An additional bounding box for the selected objects is generated on the fly, which is also subdivided.

Origin selection mode showing corners, midpoints and the bounding box of selected objects. Depending on where are you pointing, the considered objects highlight.

Plane selection mode showing corners and location axes following current orientation.
Midpoints are also present, but they appear when the cursor is near.


The bounding box in global coordinates encloses the object's local bounds. This is an approximation to the object's dimensions and its faster to calculate than using the object's geometry. This bounding box is more consistent with square shaped objects such as rectangles, planes, tables, and generally every object whose geometry reach the local bounds.

Global bounding boxes encloses the local bounds. This is an approximation to geometry.

You can use the Local bounding boxes to pick the origin or to set the projection plane.


Using the object's geometry influences the generation of the bounding box around it, and it ensures that it will be appropriately adjusted to the Plane.

This bounding box is created on the fly, perpendicularly to the current Plane and inheriting its orientation. This is relevant for the use of the Preset Alignment buttons, since these allows you to fit the objects to the center, or one side or the other of the Plane.

The use of the objects geometry always generate a perpendicular to plane bounding box. This ensures that the geometry touches the plane. You can pick an origin from any point of this generated bounding box.


Built-in Orientations











  • Global: The global coordinates orientation. The X, Y and Z axes align with those of the world.
  • Local: The local coordinates of the selected object. The X, Y and Z axes used are those of the selected object.
  • View: The current view coordinates. The X, Y and Z axes align to the view, using the planes that pass through the center of the screen. You may see a skewed projection Plane when using this orientation. This is normal, as the considered plane for the view it's at the center, and the skew is a result of perspective. If you want to see it unskewed, change to Orthographic View (Numpad 5).
  • Perpendicular (Direction subpanel): An on the fly generated direction, which is dependent on the current projection Plane. This is one Direction only, and it doesn't make use of direction axes.
  • Custom: All Custom Orientations will be listed next to the built-in orientations. They will appear grouped by Scene. To see how to add Custom Orientations, check the documentation on top of this page.


Preset Alignments



The preset alignments are some buttons with an automatic configuration to easily change the position of the alignment relative to the projection Plane. These are best understood in global coordinates, resembling 2D applications.

The alignments make use of the bounding boxes of objects. They pick the appropriate center of the bounding box, to align the object at different levels relative to the Plane.

The buttons are ordered from first to last, meaning the negative direction of the current axis, the center of the axis, and the positive direction of axis, respectively, all relative to the Plane.


The logic behind is that the alignment buttons follows the current direction axis based on the bounding box of objects. As a result, they can help you to align objects faster to the left, center and right of the Plane. The orientation in use can change what you understand for left and right, as the Z axis does with up and down. This is why these buttons work best in global coordinates, because you might end up with rotated objects whose axes don't match globals. When defining the projection Plane through local bounding boxes or some different orientation, is almost sure that your objects will not exactly fit the Plane. In those cases is best to fine tune the alignment in the 3D view using the shortcuts to pick the most appropriate origin.

You can also use the preset alignments when the objects geometry is enabled to use, this ensures a correct fit between the objects and the Plane.


Shortcuts

Align Tool provide its own set of shortcuts that will become available once you enter the interactive mode.

Here's a brief list of them

  • Enter: Align Objects
  • Esc: Cancel operator and turn off interactive drawing
  • O: Toggle moving objects individually or as a group
  • Alt + Z: Toggle wireframe/solid shading
  • H: Show/Hide Status bar
  • X / Y / Z: Select Direction Axis
  • L: Switch between Local and Global direction
  • V: Switch between View and Global direction
  • P: Switch between Perpendicular and Global direction
  • Shift + X / Y / Z: Select Plane Axis
  • Shift + Left Click: Select Global projection plane
  • Shift + Alt + Left Click: Select Local or oriented projection plane
  • Shift + Alt + Mousewheel Up/Down: Scroll through available plane orientations
  • Shift + G: Use geometry for Plane bounds
  • Ctrl + Left Click: Select Object's Global origin point
  • Ctrl + Alt + Left Click: Select Object's Local origin point
  • Ctrl + G: Use geometry for Origin bounds


You can access to the list of shortcuts directly in the 3D view by clicking in the appropriate panel located at the top left corner of the screen.





The shortcuts button at the top left corner of the 3D View.


















The shortcuts button with the panel expanded.


Known Limitations

  • No modifiers are considered when the button Use geometry is on. The geometry used is that of the base object without modifiers applied. If you irremediably need to fit well some object that has modifiers, but you don't want to apply them, you can temporally create a copy of it and apply the modifiers to the new copy, then parent your original object to the copy and just align the copy to the Plane. After the alignment you just eliminate the parent-child relationship keeping the transformation (Alt + P > Clear and Keep Transformation), then deleting the copy object.
  • If you apply modifiers acting on the shape or the amount of vertices, and you want to see the new geometry being aligned, you will have to refresh the object data either by entering Edit Mode and then going back to Object Mode, or just by exiting the interactive mode (Esc), and entering again, to force a refresh. If you don't do this, the last cached mesh will be used during alignment.
  • The geometry of non-mesh objects cannot be used, only their basic bounding boxes. If you have a curve object or a metaball whose geometry you want to exactly align to the Plane, you will have to first convert them to meshes (Alt + C > Mesh from Curve/Meta/Surf/Text)
  • Take care with very dense meshes. These are hard to process. First when entering the interactive mode, and then when the button Use geometry is on. If you try to move or rotate your object, you will probably notice some lag depending on the complexity of your object and the resources of your hardware. Dense objects will also take some time to load when they are selected the first time in the 3D view while in interactive mode.


Changelog

v1.0.0 - Initial release