Hi Guys,
I have a list in grasshopper which I am trying to reorder as seen in the attached image. Is there anyway to do that?
Thanks in advance
Hi Guys,
I have a list in grasshopper which I am trying to reorder as seen in the attached image. Is there anyway to do that?
Thanks in advance
Hi,
Yes, what you first need to do is divide your list of points into a list of lists (or tree), where each sublist (or branch) contains one row of points. This can for instance be done with a Partition component.
Then you can use the paths information that you can get with TStat an plug it into a Dispatch component. This will funnel out every even indexed path through the first and every odd indexed one through the second output.
Now you can use two Branch components to extract the relevant point branches with the path information from both Dispatch outputs.
You can then Rev (reverse) the odd or even points lists and Merge everything together again.
Thanks for you reply. I must say i am relatively new to grasshopper so i am still struggling to get the list to work. Will you be able to share a screenshot of a work around please? Also I forgot to add that the list does grow so will this affect the way the sorting works?
You’re much more likely to get meaningful help if you post your grasshopper file.
See item #3 here:
-Kevin
List sorting.gh (13.7 KB)
Hi Kevin, thanks for replying. I have attached the file now.
Thanks in advance
You’ve already got the required tree structure after the Flip Matrixcomponent.
At that point you just need to do as @diff-arch described.
Use TStat, Dispatch and Branch components to divide into odd and even branches. Use Rev to reverse the odd (or even) branches. Then Merge back together and flatten output.
List sorting_re.gh (16.0 KB)
-Kevin
Thanks you legend
As with most things in grasshopper, there are several ways to accomplish this.
The method @Baris shows gets it done with fewer components.
To use this method with the file posted, you’ll need to simplify the Data input to the Split Tree component.
-Kevin