Sort points, flip matrix inside a boundary, then merge trees

Hello friends!

I have a grid of points.
How could I sort the points in this way?

I believe the logic is this:

  1. Tree A: Sort points in y direction (defaul in SqrGrid)
  2. Tree B: Sort points in x direction (flip matrix)
  3. Replace the points in Tree A with the points in Tree B inside the boundary curve (Point In Curve + Weave)
  4. ??? Split Trees at first and last replaced point and merge by x and by y ??? (Here I stuck) (11.4 KB)

Can anyone advice?

Thank you! :slight_smile:

You could use that

Hi Laurent!

Thank you for sharing this beautiful work.
However, I am not sure how it can work with my case. I imagine it could be used for joining the lines and then sorting points along the achieved curves. But it doesn’t group the lines, and even if I join them, it creates artifacts that makes it imposible to group by connection.

I may be wrong, but I believe I need some data-managing tips to split and group trees of points…

I tried an approach of data managing, using Relative Item. It works somehow, but not perfectly fine.
Can anyone advice on how to impove this script? (24.2 KB)
I use this approach because then I will need to run Chain-Link fancing (or Rabitz) thru those points.