Group items in list based on sublists


Can anyone help and give some guidance on grouping items in lists based on their sublists?

What I am trying to do is create pipes from lines, however as some lines overlap I want to group them together into sublists and create a single pipe.

For example I have a list of 5 items (lines) and the ones at index 0,1 & 2 intersect each other, (same with the ones at index 3 & 4) and I would like to group them into 2 sublists. Is it possible with nodes or do I need a python script because I could potentially have lots more lines overlapping, therefore a loop would be more appropriate?

I tried converting the index numbers to strings, concatenating these and then trying to find substrings in strings but no luck I’m afraid. Also, the List.GroupByKey doesn’t work either.


Since you have already grabbed the indexes and they’re grouped as they intersect, you can use a List.GetItemAtIndex node to grab them from the original list.
Hope this helps!

Thanks Patrick,

But this doesn’t help as the result I want is this. Basically, I want to group those lists @L2 together if any index @L1 is common in other lists at that level.