The non-manifold geometry in 3D objects—such as individual points, edges, or polygons floating in space, as well as holes in a solid mesh—is selected in Blender using the 3D viewport menu: Select – Select All By Trait – Non Manifold. This command can also be executed using the Blender Python API via the bpy.ops.mesh.select_non_manifold() operator. If we’re working with geometry through a BMesh object, there’s no such special operator. However, we can select such non-manifold geometry ourselves.
First, let’s take the currently active object, create a BMesh object for it, and copy all of the object’s geometry into it. Now we need to select all non-manifold geometry. Switch to edit mode to visually see the selection of vertices, edges, and polygons.
|
1 2 |
bpy.ops.object.mode_set(mode = 'EDIT') bm = bmesh.from_edit_mesh(bpy.context.object.data) |
Deselect the current selection.
|
1 2 3 4 5 6 |
for vertex in bm.verts: vertex.select = False for edge in bm.edges: edge.select = False for face in bm.faces: face.select = False |
Start selecting non-manifold edges.
We’ll consider non-manifold edges to be:
- dangling edges – edges that are not adjacent to any polygons
- edges that are adjacent to one polygon – this will allow us to select holes in a solid mesh
- edges that are adjacent to more than two polygons
Let’s select these edges. To ensure correct selection, we select not only the edges themselves, but also the vertices that belong to them.
|
1 2 3 4 5 |
for edge in bm.edges: if len(edge.link_faces) != 2: edge.select = True for vert in edge.verts: vert.select = True |
Now, select non-manifold vertices. These are simply vertices floating in space, meaning they don’t have any edges attached to them.
|
1 2 3 |
for vert in bm.verts: if len(vert.link_edges) == 0: vert.select = True |
That’s all. Return geometry witn modified selection back to the mesh and clear the BMesh object.
|
1 2 |
bmesh.update_edit_mesh(bpy.context.object.data) bm.free() |
As we can now clearly see, all non-manifold geometry of the mesh is now selected, and we can perform the necessary operations on it. Most often, this means simply deleting it.

.blend file on Patreon