Group every 3 branches

Hello All,

I have a grid of points that I sort through X values:

they sorted by x so that each branch I have has points that have equal X values:

I wonder how I can sort this tree in a way that will give me 3 columns per tree branch. (or any other number) like shown here:

here’s the gh script:
sortbranchbyx.gh (9.4 KB)

thank you!!
Renan

You are sorting points by X-position but the Y-positions are not sorted.

If you sort the points with the Sort Points component, you get points ordered by X-positions, then Y-Positions, and then Z-Positions.

This is one way to get the result you are seeking.

231016_sortbranchbyx_re1.gh (12.6 KB)

Note: When you are sorting and grouping geometry, you can get some unexpected results due to “floating point fuzz”. This does not seem to affect your data but it is something you need to be aware of. For example, given geometry with these coordinates you might get some unexpected results when sorting by X,Y,Z (note the last 2 decimal digits of X-values).


In these cases, rounding the input values can overcome these unexpected results. There are many threads about this on the forum.

-Kevin

1 Like

Thank you so much Kevin, this is awesome

1 Like