Grasshopper Data Item editing

From TOI-Pedia


Data Item editing

Data Tree

The first part of the explanation is similar to the explanation of the Data Tree editing page.


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 and editing the data tree structure. Knowledge of these techniques are essential for the effective use of Grasshopper.




Data tree structure

Data Tree

Multiple data will be stored in a data tree. The data tree is the hierarchical organization of the data. Each branch of the tree can contain data. This can be a variety of data , surfaces, curves, points etc. To effectively use Grasshopper a sound understanding of this structure and how to manipulate it is paramount.


This structure and handling of data is fundamentally different then when we use an environment where the name of the object can be used to define a selection. In the case of Grasshopper the data can't be accessed by its name but only as a part of a list of data. Although the lists have an index number for every data element the separate data elements can't be defined or recognized by any kind of reference other than the index number. The data list is stored on a branch of the data tree. Each branch can hold data. The interaction of data will only take place if the data lists are at the same level of the data tree or trees. This means that to effectively access the data in a data tree structure you will have to know how the data has to accessed and the tree structure can be manipulated.



Space frame


Data from the same level , say {0;0;1} , {0,0,2} or {0;1;3} can interact with each other when the correct component is used. Like the Line component which needs more than 1 input stream. However the data of different level branches can't interact. If we have a data structure where one set of data is placed on the {0;0;1} branch and the other on the {0;1} branch they can't be used for a line for example because the data is not on the same branch level. The problem with this system is therefore the need to be able to manipulate where the data is stored in the data tree structure so that the data from different data trees can interact ( in essence the data is stored at the same level)


Different methods of using data on the branch or branches

There are 2 main options of using data on a branch or data branches. The options will depend on the component which will be used as output of the data. The options can be easily recognized by the amount of input connections for the data.


Option 1

Branch
  • The first is the component will work only on the data on the same branch within the same tree. For example a Polyline uses the data of serie of points on a single branch to define the polyline. So from the content of a branch a polyline is generated and therefore for each branch 1 polyline. There is only 1 input channel for the points needed to define the polyline. Another example is the Loft component. It also uses only 1 channel for curve input.






Branch

The same functional combination of data can be obtained with two or more data trees by connect the different data trees to the same input channel. The trees are merged and the data is placed on similar branches. In the example two data trees with each 100 branches containing each 1 curve of data are merged into a single tree with 100 branches and 2 curves on each branch. Because there are now two curves on a branch the loft will be based on these two curves. This will repeat itself over the rest of the 99 branches.


  • If however the data structure is not similar because there are additional branches in one list, the data won't be combined and handled as separate lists. So getting the data on the right level of branches can be one prerequisite of a successful merger of data.

Option 2

Branch
  • The second option is the use of a component which needs multiple inputs. An example is the line.The line needs 2 points. If a data tree structure is offered as data input for 1 of the two points the content of each point on the branch is seen as a separate input. This point will interact with a point of the same branch in the other data tree. The fundamental difference with the first option is that you always need two inputs and therefore two data structures which will interact on the same branch level.







Branch

In the example we can see a difference of the amount of points on the branch of one input and the amount of the other branch of input. In one tree structure the amount of points defined on a branch is 4 in the other tree structure 1. Grasshopper will generate in this case a line from one point of the four from one list to the 1 of the other list. It will then generate a line from the second point of the four to again the 1 in the other list, and so on. If all the four points are calculated , Grasshopper switches to a new branch and start calculating the lines between the four point and the single point of the other list. The lines therefore have a similar end point per branch. The way the lists are combined is depending on which option is selected in the option menu of the component.


List editing

As we have seen the data in Grasshopper is stored in a Data tree structure. If you want to use any data in Grasshopper you have to extract the data items from a data list. This can be some times quite an exercise in editing the lists to finally get to the correct data. There are a variety of tools available for

Personal tools
Actions
Navigation
Tools