10
$\begingroup$

There are several questions on merging connected edges and edge loops, but I can't find the simplest case where we just have two edges:

enter image description here

and want them to be merged like this:

enter image description here

I don't have a requirement on the location of the final edge, but I guess a comprehensive answer would encompass the different possibilities: merging at active edge or at mid-distance.

I know I can:

  • move a vertex onto the other using the snap option,
  • select the four vertices,
  • remove the two doubles.

But that's four operations. Can it be done more quickly?

$\endgroup$
4
  • $\begingroup$ The steps are pretty quick ... I suppose there is no quicker way as far as I know. unless you want to write a script with a shortcut attached to it. $\endgroup$
    – hawkenfox
    Commented Jan 14, 2016 at 8:13
  • $\begingroup$ It looks like you want a script that will take two edges into account, the vertices of the selected edge should move towards the closest vertices of the active edge. ? $\endgroup$
    – zeffii
    Commented Jan 14, 2016 at 8:23
  • $\begingroup$ I would simply use snapping tools $\endgroup$
    – m.ardito
    Commented Jan 14, 2016 at 9:33
  • $\begingroup$ Same as here: blender.stackexchange.com/questions/44308/… $\endgroup$
    – stacker
    Commented Jan 14, 2016 at 9:58

6 Answers 6

15
$\begingroup$

There is also the option:

  • Select both edges
  • CtrlE > 'Bridge Edge Loops', with 'Merge' checked.

The 'Merge' option will remain checked for repetitions of the operation.

If 'Loop Pairs' is also checked, the move can be made on multiple pairs of edges simultaneously.

enter image description here

$\endgroup$
12
$\begingroup$

Maybe this is a little faster ... hmmm But you will have to turn on the addon called "F2"

  1. Select the 2 edges.
  2. Hit F, connects the 2 mesh and gives you 2 original edges.
  3. Select the extra edge you didn't need. Hit X dissolve the edge.
$\endgroup$
7
$\begingroup$

Just select one vertex from each edge, hit Alt + M > Merge at first or at center, then do the same with the other two vertices and it is done.

This way yo just make 2 steps each vertice.

This leaves no double vertices and its an easy way to join edges (can also join various vertices)

$\endgroup$
2
  • $\begingroup$ Your answer is fine, but a Screenshot or GIF would go a long way in making it clearer. $\endgroup$
    – Ben
    Commented May 8, 2019 at 6:38
  • 1
    $\begingroup$ Thanks, i didn't thought about that. $\endgroup$
    – Maurice
    Commented May 19, 2019 at 17:20
2
$\begingroup$

It looks like you want a script that will take two edges into account, the vertices of the selected edge should move towards the closest vertices of the active edge.

In code that looks like:

# This example assumes we have a mesh object in edit-mode

import bpy
import bmesh
from bmesh.types import BMEdge

def move_edge_verts(obj):
    me = obj.data
    bm = bmesh.from_edit_mesh(me)

    # get active edge or return early
    active = bm.select_history.active
    if not isinstance(active, BMEdge):
        print("no active edge")
        return

    av1, av2 = active.verts[:]

    # get first selected edge that isn't active
    selected = None
    for e in bm.edges:
        if e.select and not e.hide:
            if e == active:
                continue
            selected = e
            break

    if not selected:
        print('no selected verts beyond the active edge')
        return

    # find corresponding verts and move
    sv1, sv2 = selected.verts[:]

    if (sv1.co - av1.co).length <= (sv1.co - av2.co).length:
        sv1.co = av1.co.copy()
        sv2.co = av2.co.copy()
    else:
        sv1.co = av2.co.copy()
        sv2.co = av1.co.copy()

    d = 0.0001
    bmesh.ops.remove_doubles(bm, verts=[sv1, sv2, av1, av2], dist=d)

    # Show the updates in the viewport
    # and recalculate n-gon tessellation.
    bmesh.update_edit_mesh(me, True)

# Get the active mesh
obj = bpy.context.edit_object
move_edge_verts(obj)

it could have many improvements; like dropping the remove doubles step and updating the edge vertex indices to use the existing indices of the active edge instead.

note:
However -- there is an obvious potentially false assumption here, the corresponding vertex on the other edge might not be the closest. A solution is to make the geometry less ambiguous or improve the closest point search algorithm

for example the scenario on the left is obvious to us, and the algorithm will get it right because the corresponding vertices on both edges are nearer their counterparts.

enter image description here

The example on the right will get results depending on which vertex index is looked at first, can work, can fail. Obvious to our eyes, not so obvious to the dumb algorithm I use above.

$\endgroup$
1
$\begingroup$

It's actually easy you can simply

  1. select both vertices
  2. press "W" which brings up the specials menu
  3. then select "Merge" or simply skip step 2 and hit "alt+M" from the get go
  4. lastly select any of the options like "At First" and they're merged at the point of the first vertex you selected.

If you press F you're creating a new face and you're basically taking the long way about this issue. Both ways work but you're making more trouble for yourself that way and potentially developing bad habits.

$\endgroup$
1
  • $\begingroup$ Does not work in Blender 3.5: hitting W in Edit mode does something completely different...it does not bring any kind of menu whatsoever. $\endgroup$
    – fafa
    Commented Oct 3, 2023 at 7:15
1
$\begingroup$

Now in Blender 2.83, select vertices to join in edit mode (use vertex selection). Then simply press M for merge (Alt-M does a split now), then merge centre.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .