How to find groups of lines that are touching each other

Hello!

I’m stuck on figuring any method, that could be used to find clusters of curves, that are near each other.

I have curves that are representing building facades, and I want to group them by specific buildings.

I only get so far, that I find which other curves are close to 1 specific curve.
Result is, I’m getting a list for each curve with possible adjacent curves.

I need to somehow combine branches, that have at least 1 overlapping index.

I have a milkbox component that can eliminate duplicate curves, so I only need to join the branches.

Any help much appreciated!

Best regards,
Janis

Curve clustering.gh (11.6 KB)

With your particular geometry, here’s one way to group the curves that touch. This might not work for all cases but since your curves appear to mostly consist of vertical extrusions, it works:

This relies on the Duplicate Lines component from Kangaroo and Join Curves with Tolerance from Wombat. Curve clustering.gh (11.8 KB)

1 Like

For this solution you need Heteroptera plugin to find region

Curve clustering_2.gh (18.7 KB)

1 Like

Thank you @andheum and @anon39580149!!!

I can already see, where both of these solutions could solve not only this problem, but some of my other issues as well.