Grouping pipes in list based on distance

The image below is part of code in which im trying to group pipes based on actual distance between their centerlines vs Min(pipe diameters + tolerance (if any)) if distance> Min, I will separate them.
For example here I have 6 pipes, according to this criteria i need to group them in list such that the output is [[0,1],2,[3,4],5]

Hi @ahmed.aelgammal ,

You can use the node Group.ByKey to group your pipes.
According to your script i think you can use your true/false list as keys input