algorithmic modeling for Rhino
Hello, I am new in Grasshopper, and I am trying to sort a set of values from maximum to minimum without success. I have tried reversing the list but didn´t work.
Any ideas?
Thank you!
Tags:
Hola, lo habitual es usar Sort List y hacerle reverse a sus outputs.
El problema aquí es la estructura de datos que recibe el Sort List, le estas dando árboles en lugar de listas. Cada rama del arbol es una lista que en tu caso solo contiene un elemento, entonces el Sort List entiende que quieres que se ejecute una vez por cada lista/rama del árbol, y al ser de un solo elemento, no hay nada que ordenar. Se puede resolver reestructurando los datos, pero para eso es necesario saber cómo debes organizarlos.
Quieres ordenar todos los datos? o ordenar subconjuntos de esos datos?
Para el primero, debes aplanar el árbol para pasar de tu estructura actual {A;B} a {0}, haciendo que cada elemento de cada rama pase a la misma lista. Puedes hacerlo utilizando flatten (click derecho> Flatten) en el componente Geometry.
Para el segundo, pasando de {A;B} a {A}, debes usar el componente Shift Paths.
Y en las salidas del Short List, hacerle el reverse.
Google translation (pretty good!):
Hi, the usual thing is to use Sort List and make it reverse its outputs.
The problem here is the data structure that receives the Sort List, you are giving trees instead of lists. Each branch of the tree is a list that in your case only contains one element, then the Sort List understands that you want it to be executed once for each list / branch of the tree, and being of a single element, there is nothing to order. It can be solved by restructuring the data, but for that you need to know how you should organize them.
Do you want to sort all the data? or order subsets of that data?
For the first one, you must flatten the tree to move from your current structure {A; B} to {0}, making each element of each branch go to the same list. You can do this using flatten (right click> Flatten) in the Geometry component.
For the second, moving from {A; B} to {A}, you must use the Shift Paths component.
And in the outputs of the Short List, do the reverse.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by