I'm looping over several meshes. For each mesh I perform several bmesh.ops

bmesh.ops.subdivide_edges(bm, edges= to_subdivide, cuts=1)
bmesh.ops.dissolve_verts(bm, verts= to_dissolve, cuts=1)

Up until here, order is as expected. For every subdivided edge a vertex is added with the index = len(bm.verts)

After performing another subdivide_edges the order gets messed up, The following loop finds the correct edge, but the index of the new vert is random instead of len(bm.verts)

for e in bm.edges:
        if e.calc_length() > 1.5:
bmesh.ops.subdivide_edges(bm, edges= to_subdivide, cuts=1)

I can avoid the problem by converting back to mesh again before the loop

bm = bmesh.new()
obj = bpy.data.objects[0]

What is the reason for the wrong order and is there another way to return the new vert index of the subdivided edge?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.