Edge rings?

Anyone know the pythonic way to get edge rings?

It looks like the bmesh polygon loops could be used to generate them but It also looks like that will take some work.

Cheers!

Yes and yes :slight_smile: Here’s a simple example of walking on edge rings (it doesn’t consider edges with more than two faces connected, can go into infinite loop if mesh is water-tight, etc., etc.):


import bpy
import bmesh

# Walk rings from currently selected edges.
# Run this in edit mode!

def rings(loop):
    while True:
        # If radial loop links back here, we're boundary, thus done
        if loop.link_loop_radial_next == loop:
            break
        # Jump to adjacent face and walk two edges forward
        loop = loop.link_loop_radial_next.link_loop_next.link_loop_next
        loop.edge.select = True

bm = bmesh.from_edit_mesh(bpy.context.object.data)
selected_edges = [ e for e in bm.edges if e.select ]
   
for edge in selected_edges:
    # Get rings from "forward" loop
    rings(edge.link_loops[0])
    # Get rings from "backward" loop
    rings(edge.link_loops[1])

bm.select_flush_mode()
bpy.context.object.data.update()

Wow. Thanks Pancakes.
Looks like you’ve already done the work.

I don’t suppose you have a similar method for getting the edge loops?

I don’t have a ready code to extract here, but it’s straightforward: you jump one loop forward, jump radial loop onto adjacent face and walk one loop forward once again.