enter image description hereI'm trying to merge verts on a mesh that's been created with bmesh bm.faces.new(). The problem is that none of the verts are merging and I can't figure out why. Below is what I believe to be the relevant code.

Three verts share the same location, but even if they didn't I expect the large threshold would merge them anyway. The selected object is correct when I print it.

The snippet runs with out error in creating the mesh and "Info: Removed 0 vertice(s)" appears. After the code runs, I can without issue enter edit mode and manually select the verts and merge them. I've tried other variations of this code with similar results or (usually) polling errors. I'm obviously missing an important detail...

        # Make a new BMesh
        bm = bmesh.new()

        me = bpy.data.meshes.new(objName)

        # Add the mesh to the scene
        obj = bpy.data.objects.new(objName, me)

        # Select and make active
        context.view_layer.objects.active = obj

# Mesh contains list of faces with list of verts
mesh: list[Faces] 

drawBMeshMesh(mesh, bm)

def makeBmeshVert(x: float, y: float, z: float, bm):
    return bm.verts.new(x, y, z)

def makeBmeshFace(bmeshVertsTuple: [BMVert], bm):
    return bm.faces.new(bmeshVertsTuple)

def drawBMeshMesh(mesh, bm):
    bmVerts = []
    bmFaces = []
    for face in mesh.faces:
        # Hold the [BMVert]
        faceList = []
        for vert in face.verts:
            bmVert = makeBmeshVert(vert.x, vert.y, vert.z, bm)


        bmFace = makeBmeshFace(faceList, bm)

    if bpy.context.selected_objects != []:
        for obj in bpy.context.selected_objects:
            if obj.type == 'MESH':

  • $\begingroup$ the provided code is partial: we dont know what makeBmeshVert/Face do. But considering they are doing expected things, first though: nothing is selected either at object level or at vertex level, so that remove_doubles makes nothing. $\endgroup$
    – lemon
    Jan 9 at 16:47
  • $\begingroup$ @lemon the object is selected. The issue may be in vert selection. How would one go about selecting all the verts? $\endgroup$ Jan 9 at 17:41
  • $\begingroup$ Perrishnikov, that can be done at bmesh level, but the provided code does not show how the bmesh is done. Each BMVert as a 'select' property: set it to True. Consider also the bmesh op here docs.blender.org/api/current/… $\endgroup$
    – lemon
    Jan 9 at 17:47
  • 1
    $\begingroup$ @lemon You solved the problem. Adding bmVert.select_set(True) and bmesh.ops.remove_doubles(bm, verts=bmVerts, dist=.1) at the end of the loop worked. Thank you! $\endgroup$ Jan 9 at 18:56
  • $\begingroup$ You're welcome! $\endgroup$
    – lemon
    Jan 9 at 18:59

1 Answer 1


Even if we don't know all the details about how the bmesh is created and updated to a mesh object,


won't work if the vertices are not selected.

So, for each bm vertex, either use v.select_set(True) or v.select = True before calling the bpy.ops.

And if you're using bmesh.ops.remove_doubles, just give the wanted vertices as parameter.


You must log in to answer this question.

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