1
$\begingroup$

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()

example about loose edges: enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

Verts with no linked faces

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()
$\endgroup$
1
  • $\begingroup$ Work fine. According to you to simulate "Delete loose" vertex, edge, face this method can be fine? $\endgroup$
    – Noob Cat
    May 3, 2019 at 16:27

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.