# how to align objects by face?

How would I go about aligning a pair of objects along one of their faces?

As an example, I take a cube, and rotate its objectdata a random number of degrees on all 3 axis. then I create another cube, which I want to connect face to face with the first one. how would I do it?

I know about Alt-R to “clear rotation”, and that will work well with primitives, or simple objects which are built entirely off of a primitive, but not more complicated shapes. (I’m screwing up the object data intentionally for demonstrative purposes btw, so no suggestions to rotate in object mode please ;))

If I have a more complex object, say a bicycle frame, and I model a water bottle holder seperately which I then want to attach to the downtube (whose angle is unknown) is there a way to do it?

Ok try this, go to edit mode for the bike, then seelect the group of vertices that the bottle water holder will be “attached” to. Hit N to bring up the transform properties and you should get the X,Y,Z rotation for that set of vertices. Then set the rotation of the bottle water holder, also using the transform properties, to the X,Y,Z rotations of the verts you just looked at. I’m not 100% sure this will work, so let me know how that goes.

If you rotate one cube randomly in all 3 axis, you can then add another cube and in object mode select this one followed by the first one while holding the shift key, then press ctrl-c and choose rotation.

Peasley/Hazaa: Thanks for your suggestions, but unfortunately both of them would only work if I had rotated the initial object in object mode, and had not messed with its objectdata in editmode.

Peasley: The vertices will not give a rotation value, only a median x, y, and z position. A rotation value is only given in object mode, and that is for the overall object.

Hazaa: The rotation for the first cube is zero, since it had its vertices rotated, and not the object itself.

You could select the a face on your rotated cube, press shift V and choose one of the options. Top usually works for me. Then the view would be shifted so that it is facing the normal of the face. Shift S, cursor to selection to snap the cursor to the face. Leave edit mode and without changing the view, add an empty. Then perhaps you could snap your other object to the empty by using copy location and rotation constraints? (after modifiying the center of the object to be snapped appropriately to the part which should lie flush with the cube’s face.)
You could bake the constraint by using the script on the Object menu: Object/Script/Apply Deformation. It creates a duplicate object on the same position, but without the constraints. Ctrl Shift A (apply deformation) doesn’t work in this case.

Thanks grafix,
That will get me by for now, at the level I’m working at.

I’ll have to learn some python and write a script as a more permanent solution. It would surely be a useful tool.

While it’s a bit clunky, you can use the camera to get two faces perfectly parallel. Let’s assume that when you’re done, object A will have moved, while Object B is to stay stationary.

1. Select a face on Object A in Edit mode. Press Numpad * to align the viewport to this face, then Numpad / for local view. Do Ctrl-Numpad 0 to align the camera to this view. Press Numpad / to leave Local view. Tab into Object mode. Shift-RMB the camera, then Ctrl-P to parent object A to the camera.

2. Select object B, tab into edit mode. Select the desired face. Press Numpad *, then Numpad /. Press Ctrl-Numpad 0 to align the camera to view. Numpad / to leave Local view, Tab into object mode.

Blender (Win32, v2.42) has a slight glitch here. The camera has moved, but its child object didn’t. Select Object A, then Gkey -> Esc to tweak object A to the right spot.:rolleyes:

1. Select the camera. R-Y-Y, type in 180. This rotates object A so the two faces are parallel and facing toward each other. Select object A, then remove the parenting relationship with Alt-P-> Clear Parent and Keep Transformation.

2. Select both A and B. Turn on “Move Object Centers Only” in the 3D header. Scale with the S-key to move the objects closer together. If you want them contacting, I think this can only be done by eye.

As usual this sounds more complicated than the actual doing. It actually works though. Can anyone find a way to smooth this process?