Grasshopper Basic List Actions
Grasshopper uses, in contrast to a programming environment, no object names to define an object. This may sound trivial but it one of the most fundamental differences from a traditional modelling environment. In Grasshopper the object or objects are placed in a list. The different lists of data are organized in a data tree structure where every branch and data content of the branch have an index number. Accessing the object is therefore more problematic then in a scripting environment. Grasshopper has various tools to remedy this problem. These tools supports the editing and selecting the content of the lists. Knowledge of these techniques are essential for the effective use of Grasshopper. These skills will be explained in this wiki. To keep the examples simple, a panel with numbers is used. These numbers can represent many different things. For example: points, curves or surfaces.
The List item selects an item or multiple items from the list. Take note of the indices in the input list (numbers in front of the value). The indices start at 0, not at 1.
The list Length component returns the number of items in a list. In the second example List Lengtht is used to obtain the last item in the list, regardless of the number of values. This makes this definition parametric. Note that you will need to subtract 1 from the list length since the indices start at 0!
The purpose of reverse list is quiet obvious. This component can also be used to get the last item of the list by reversing the list and get the 1st item (index 0).
Shift list moves the items in the list by the shift value (S). A positive (S) moves the items up in the list and a negative (S) down. Wrap around (W) prevents items from "falling off" the list by moving them to the other end.
The sort list component can be a very powerful one. Its default functionality is to sort the list (K). Aside from that input there is the possibility to attach more lists (A,B enz.) These lists will be sorted in the same order as the first list. The content of the secondary lists doesn't need to be sortable as the first list (K) should be. The second list can be geometry, text etc.
Split list splits a list into two seperate list. The second list starts with the index (i).
With sub list you can select a part of a list using a domain. Elements outside the specified domain will be eliminited from the output.
Partition list works as a combination of the "split list" and the "sub list" components. Input (S) sets the split pattern by the amount of items each list should contain. This pattern will be repeated until all items are placed.