# bmesh.ops method to get Loose vertices / edges and delete from that list?

I read all the api about bmesh.ops, but not find and not have idea to get loose edge/vertices , someone knows something about it, I don't even find examples to get and then delete with method bmesh.ops.delete(bm, geom, context) Equivalent with ops (Slow if have many object) bpy.ops.mesh.delete_loose()

meshes = set(o.data for o in context.selected_objects if o.type == 'MESH')
bm = bmesh.new()

for m in meshes:

bm.from_mesh(m)
####get list of loose vertices/edge?
####delete vertices?
bm.to_mesh(m)
m.update()
bm.clear()


Possibly easiest here is to look for verts with no linked faces. ie they make no part of any face

import bpy
import bmesh
context = bpy.context

meshes = set(o.data for o in context.selected_objects if o.type == 'MESH')
bm = bmesh.new()

for m in meshes:

bm.from_mesh(m)
# verts with no linked faces
verts = [v for v in bm.verts if not v.link_faces]

print(f"{m.name}: removed {len(verts)} verts")
# equiv of bmesh.ops.delete(bm, geom=verts, context='VERTS')
for v in verts:
bm.verts.remove(v)

bm.to_mesh(m)
m.update()
bm.clear()

• Work fine. According to you to simulate "Delete loose" vertex, edge, face this method can be fine? May 3, 2019 at 16:27