4
$\begingroup$

I'm trying to use the center (midpoint) of a particular edge in a mesh as the snap target.

I have two mesh objects. The first has an edge aligned with x axis. The second also has an edge (different length/location) aligned with x axis. I would like to align the two objects constrained to x axis: so that the center of the edge in the first mesh snaps to the center of the edge in the second mesh (see image).

enter image description here

I used this feature a lot in 3DS Max and can't figure out how to do it in Blender. I'm looking for a quick way since I'd really use this a lot. Preferably a way that can be used in object mode as well as in edit mode with an island of faces.

$\endgroup$
1
$\begingroup$

The quickest way I've found to do this is to use the transform panel in the properties shelf of the 3D viewport. The way I do it is to select both vertices of the edge in mesh 1, go to the transform panel, and (in this case) copy the x value [circled in the image below] (either using CTRL-C, or using the dead-tree method).

snap 1

The x value will be the median value for the x values of the vertices. Then, deselect the vertices in mesh 1, select all of the vertices in mesh 2, and paste the x value from the vertices in mesh 1 into the x value in mesh 2, or if you used the dead-tree method, click on the x value box and enter the value manually.

snap 2

This moves mesh 2 to the new median point.

enter image description here

To apply the technique more generally, a bit more math may be necessary. Suppose that it was desirable to snap the objects so that the right edge of mesh 1 was aligned with the left edge of mesh 2, or that either or both of the meshes were not symmetrical. In this case, one would find the median value of the desired snapping point in mesh 1 as above. Then the median value of the same coordinate of the part of mesh 2 that was to be aligned with the part of mesh 1 would be determined by selecting the appropriate number of vertices. Then determine the offset by subtracting the value of the snapping point in mesh 1 from the snapping point in mesh 2, select all of the vertices in mesh 2, and subtract the offset from that median value. Since Blender supports regular expressions in the co-ordinate boxes, this can be done directly in Blender, at least for simpler meshes.

The same general technique will work to align objects (in object mode), though the operations are a bit more constrained as only the object center values can be manipulated using these techniques.

$\endgroup$
  • $\begingroup$ Very helpful: I have tried it and agree that this is the quickest way I have found so far. Although it still takes to enter edit mode, select, copy, exit edit mode to get the median coordinates, this method can be done within an acceptable ammount of steps. It's flexible enough too and I don't mind the math part. $\endgroup$ – Booth Sep 5 '14 at 9:18
  • $\begingroup$ Actually, you don't need to leave edit mode to get the median point. When you select more than one vertex, whether by selecting the vertices directly, or indirectly by selecting edges and faces, each of the three values (x, y, and z) shown are the median of the x-, y-, and z-values of all of the selected vertices. You can verify this yourself. Open a new default scene, switch to edit mode, vertex select, and select each of the vertices one by one, and observe the changes in the x, y, and z dimensions. $\endgroup$ – brasshat Sep 5 '14 at 12:21
  • $\begingroup$ I meant: I need to enter edit mode to get the median coordinates, then leave edit mode to select the mesh I wish to align. The very nicest solution would be one where I don't need to enter edit mode, do something, then leave edit mode and select the other mesh... $\endgroup$ – Booth Sep 8 '14 at 12:02
  • $\begingroup$ That's true, if aligning separate objects. However, if one knows that one is going to want to align objects, one can create a single object containing both meshes, and separate them in to separate objects after alignment. $\endgroup$ – brasshat Sep 8 '14 at 14:45
2
$\begingroup$

Using the snap to function it's quite easy.

In edit mode select the edge you want to align to, then press ShiftS and select cursor to selected. The 3D cursor will be placed in the middle of your selected edge.

Back in object mode select your second mesh and do ShiftS and select selection to cursor your object will then move to where the cursor is.

From there you can move the 2nd mesh using GY so it only moves on the Y axis.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ But what if the elements to be aligned are part of the same objects? $\endgroup$ – brasshat Sep 4 '14 at 16:53
  • $\begingroup$ It would still work. $\endgroup$ – user1853 Sep 4 '14 at 17:43
  • $\begingroup$ This is useful and good to know. I've tried, it works and I will experiment with the possibilities in this method more. Would be nice if selection to cursor could be constrained to an axis... also, this still takes quite a few steps to do compaired to 3DS Max, where I could grab an entire object by a particular edge without entering edit mode and translate the object, snapping it to another object's edge, constrained to an axis, so the two edges are aligned center to center. (I still love Blender anyway I'm just a little bit disappointed) $\endgroup$ – Booth Sep 5 '14 at 9:03
  • $\begingroup$ I just find how to snap with axis constraint ! Quite simple in fact : you just do the technique above, and lock axis on the transform panel :) i.imgur.com/ze3aipu.png $\endgroup$ – Vinc3r Sep 20 '16 at 7:59
0
$\begingroup$

I'm not entirely sure if this is what you're looking for, but I think I can help here at least with the Edit Mode use. If you were to subdivide the edges in question by either pressing Mesh > Edges > Subdivide or Ctrl-E > Subdivide, that'll give you the middle vertex you need to align them. You could then turn on Snap To Vertex with Ctrl-Shift-Tab then select Vertex. Then hold down Ctrl while you're moving one of the objects and it'll snap to the nearest vertex to your cursor. Once it's in place, you could go back to Edit Mode and dissolve the vertices you added with the subdivision (if you so desire).

Again, I'm not sure if that's what you're looking for but it might help at least. And a note: the vertex snapping works in both Edit and Object Mode, but moving it in Edit Mode gives you more control from what I've seen. I've tried aligning objects in a similar fashion in just Object Mode, and it only goes to a corner vertex.

$\endgroup$
  • 1
    $\begingroup$ Yes, this can be done and the result is indeed what I am looking for, but I'd need a quick way, since this is something I'd use often. Right now I just zoom in and do it by sight (approximately) or snap it to a vertex and translate it by calculating the distance and typing it in... but both ways are tiresome and not satisfying... $\endgroup$ – Booth Sep 4 '14 at 15:42
  • $\begingroup$ I did a little more research and I came across this question on here: blender.stackexchange.com/questions/2289/… This might help you a bit more. $\endgroup$ – Forged-In-Steel Sep 4 '14 at 16:45

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.