# Edge Loops and Python. Enumerating and Analysis

Does Blender Provide any Edge Loop identification in Mesh or BMesh? If yes, what is the link or document that describe such support?

Showing edge indices of a selection. Image Above.

Crude Console Output from a Python Blender Script. Please excuse the many flaws of omission and commission in presentation and explanation. The intent is to show cyclic and non cyclic edge loops. Simple Case. The arrow shows a correspondence between selected edges and console text. The text will be transformed into text compatible for Python Execution. Click to see larger image for improved readability. Image above.

Blender Python Code Sample. Subject to extreme cleansing and refactoring. Read at your own risk. Image Above.

Probably inessential and subject to deletion

Console Window Output with debug identification.

ED_undo_push: Loop Select wm_handlers_do_intern: handled! 'MESH_OT_loop_select'

Just to clarify I am talking about the connected edges the users see when they Alt-Click in edit mode and perhaps other selections.

Here is an example context

• Given a edit mode selection or vertex group selection. Consider only the selection as though it were isolated.

• How many cyclic and non cyclic edge loops are present? What are they?

• The answer might be a Python list of lists of vertex indices.

I am asking for a reference to tested Python in this question. I am not asking for new Python to be written.

I have some Python script. I do not want to reinvent functionality. Although there could be some merit in Blender Python programming exercise. This analysis is not supposed to be the most general case. It might not even need to algorithmically efficient such as big O = n squared. Preprocess.

• These edge loops you are talking about are not stored anywhere. Alt+Click is a tool that selects edges along quads. This selection is calculated on the fly. – Dimali Aug 30 '17 at 18:33
• I once wrote something that tests if the current selection is a closed edge loop, can try find it if it could help. Can't say its too heavily tested but worked fairly well for its purpose. Don't know of any built in method to either recognize nor enumerate edge loops. – TLousky Aug 30 '17 at 21:32
• Just to clarify, is this the same as selecting an edge and calling Select Edge Loop ? – batFINGER Aug 31 '17 at 5:45
• @TLousky. Thanks. No need to find Python .... yet. I have something perhaps similar. It Selects an edge loop. So that functionality can be used as building block. Same results as user gestures. – atomicbezierslinger Aug 31 '17 at 17:37
• Not a big fan of all the caveats on this question? Why not show some of your code ie what you've tried so far? A link only answer to proven code? Console output with debug info? Yep it is just a shortcut to bpy.ops.mesh.loop_select To select an edge loop from an edge, with verts v1 and v2, edge is edge loop i of v1, keep selecting next edge, which will be edgeloop i of v2 .. etc until you get back to starting edge, or not. Each vert must have 4 edge loops etc. – batFINGER Aug 31 '17 at 18:48