Grasshopper Basic List Actions

From TOI-Pedia

List editing

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.

List item

List item with a single output
List item with multiple outputs
List item used in combination with subtraction

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.

List length

List length1.jpg

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!

Reverse list

Reverse List1.jpg

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

Shift List1.jpg

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.

Sorting list

Sorting List1.jpg
Sorting list and sublist

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

Split List1.jpg

Split list splits a list into two seperate list. The second list starts with the index (i).

Sub list

Sub List1.jpg

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

Partition List1.jpg

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.

Personal tools