Just group all intersecting lines


As stated in the title, The rule is grouping these unordered line segments which intersect directly or indirectly. (All the intersections are at both ends of lines)
It doesn’t look difficult, but I failed to come up with an elegant approach as concise as possible… maybe I thought it in a complicated way.

Either gh or ghpython :flushed:

You probably should post what you already tried…

I tried to get it with for loops in python, but ended with a messed up data structure…


Maybe it’s buggy but seems to work so far.
It’s too hard for me as a python noob. :sob: :sob: :sob:

For complex cases that cannot be correctly classified, this is a fixed version(so far) :robot:

Group if endpoints intersect.gh (14.8 KB)