# Subsets of curves by loop

Hello everybody

I would like to ask for some help with what I consider to be a topological problem:
In the example bellow I have 6 curves that are connected at the ends, forming -kind of- a tetrahedron.
I’ve been trying very hard to find a way to create 4 sublists, each containing 3 curves that form a closed loop. This is something that I do very often in my work but have never found a way to do it automatically.
(to make it more clear: from the top list of 6 curves, I want to automatically extract the 4 lists bellow that correspond to the 4 loops of the ‘network’
Do you know of a method (or a plugin) that can do it? Or at least a direction to search.

NOTES:

• here, I created a very simple example of 6 curves, in reality I want to use it with more complex ‘networks’
• I created the solid ‘tetrahedron’ just to show the grouping. Don’t assume that this is my goal, my goal is to create a list of curves for every loop that is formed within the network. (to be used for other operations, NOT to create solids or anything like that)
• In more complex networks, the loops might be comprised of more than three curves.

erase.gh (16.7 KB)

Hi,

Two ideas :

• Use Mesh.CreateFromLines RhinoCommon method to build a mesh from lines representing a simplified version of your geometry. Then` Face Boundaries` gives you the list of lines per face, it’s just a matter of searching for the closest point in the original pool of curves.
Drawback : you have to specify the maximum number of sides for Mesh From Lines to work, which you may not always know. And I’m sure there are some cases where it will fail to build a decent mesh.

erase.gh (17.5 KB)

• Nautilus plugin has a Curve Network Topology component (not sure of the name ) that will process a connectivity tree between vertices and curves. From there it’s a graph theory problem to find closed loops and probably someone has a solution with code.

Here’s a possibility. I’m not sure how robust it is.

closed curves.gh (13.4 KB)