Sort polycurves by minimal gaps between start and end points to close loop

Hello, community!

I have 3 polycurves, 1,2,3:
There’s a small gaps between starts and ends of them, simple grouping curves doesn’t work.

Starts and Ends of them:
1.S-1.E
2.S-2.E
3.S-3.E

Some of them are reversed, some not. Some are not in place to get closed loop, if connect 1.E-2.S,2.E-3.S with lines:

1.S-1.E
3.E-3.S (reversed)
2.S-2E

So, i need to sort that curves to connect Ends and Starts with lines and get closed loop.
Any thoughts?

Thanks!


JoinCurves.dyn (37.7 KB)

3 Likes

@Vikram_Subbaiah,

Can we modify function for work with sublists? Tried packing in custom node, various lacing - no effect.
If possible, for @@L3 depth. For rooms with inner columns contours.

Thanks!