I'm trying to get edge loop, starting from one edge and continuing as far as the loop goes.

The following code does not work, because vertex index order is disrupted, so I have no apparent way of telling which edge of link_edges is continuing the loop.

v = bm.verts[0] # vertex at the start of edge loop
ov = edge.other_vert(v)
le = ov.link_edges

while len(le) == 4:

    e = ov.link_edges[-1]
    ov = e.other_vert(ov)

    le = ov.link_edges
  • $\begingroup$ What about bpy.ops.mesh.loop_select $\endgroup$
    – sambler
    May 22, 2017 at 2:16
  • $\begingroup$ @sambler Mesh operators are not accessible from BMesh. And I do not need to select those edges, I need to add them to the list. $\endgroup$ May 22, 2017 at 8:20

1 Answer 1


The solution is to use BMLoop, as it is the only element that has constant direction and doesn't depend on the order of other elements.

This example code works only with manifold geometry where all face normals facing one direction.
Look in the comments to the answer for additional information and examples from Blender core dev.

e = bm.edges[0] # edge at the start of the edge loop

# get BMLoop that points to the right direction
for loop in e.link_loops:
    if len(loop.vert.link_edges) == 4:

# stop when reach the end of the edge loop
while len(loop.vert.link_edges) == 4:

    # jump between BMLoops to the next BMLoop we need
    loop = loop.link_loop_prev.link_loop_radial_prev.link_loop_prev

    # following edge in the edge loop
    e_next = loop.edge

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.