Surfaces Sort by Distance


I splited surfaces by curves, then the order of surfaces became a mess.
I have tried to Sort surfaces by distance between the center of each surfaces and a point of the red lines as below.
But only B part is correct.
There is even flipped part as A part.

It would be very helpful for me to know the reason and solution.

Here is GH:
Surfaces Sort by (17.0 KB)

Thanks for you help in advance!

Surfaces Sort by Distance why (26.1 KB)

Is it what you look for?

1 Like

when I see some sorting of points does not look right, I always drop a line component on the canvas to check what actually is going on in the data tree

in this case it looks like this:

you can use the nice solution shown by @Petrol , or use a few trim tree and partition list in your definition to break and rebuild the outmost branches of your data tree after the Distance component

Surfaces Sort by (23.4 KB)


Hi Petrol,

Thanks for the your solution.
It is half correct.
I need to get the surface order like the points in your scripts.

Hi Inno,

Thanks for the your solution.
It works nicely.

My (29.1 KB)

1 Like

Check this as well.

Surfaces Sort by (22.4 KB)


Thanks a lot.
It works and I am trying to understand it.

Nice tricky one

Hi Kim.

Thanks for the solution. :+1:
It is amazing to learn many different solutions.