# List of contiguous faces of bmesh

Is there a way to get the list of the connected faces of the bmesh in their connection order? In other words, if I start from any random face within a continuous bmesh I should get the list of all the faces and each of them should be ordered in such a way that it is connected to (i.e. sharing an edge with) the preceding one in the list.

• How exactly is the selection in the video we see made? Did you select it by hand or did you use a function in blender for that? Can you also share the .blend (maybe not needed n this case but speeds up the testing and answering process) Commented Sep 8, 2018 at 16:37
• I wrote the function myself, which traverses along the connected edges in clockwise direction. But as you can see it gets into a cul-de-sac at a point. The mesh is very simple a cube with a couple of extruded faces and some dyntopo sculpting. And it's triangulated to simplify the algorithm. Commented Sep 9, 2018 at 4:47
• Could you give us the algorithm and the .blend so we can debug it better? Commented Sep 9, 2018 at 9:34
• The .blend is at:<img src="https://blend-exchange.giantcowfilms.com/embedImage.png?bid=5221" /> The algorithm is kind of naive.. take a face and an edge, get the second edge from this one and select the face. I am looking for a better algorithm not a fix in this one :) Commented Sep 9, 2018 at 10:12
• Just in case my earlier comment sounded impolite, I just want to let you know that I did not mean to be rude. It's just that my algorithm is all wrong and sharing it will not help at all. For example I started with the assumption that the triangle edges and faces have a standard convention of indexing the vertices. Looks like this assumption is wrong. That's the reason I said I'm looking for another, better algorithm, which takes into consideration the blender specific way of arranging the faces. Commented Sep 9, 2018 at 14:40