Reassemble DataTrees

The current build of grasshopper does not allow the input of dataTree objects to a script component. However, for reasonably simple trees it is also reasonably simple to re-create them from scratch using some loops and a branch list. The following outlines how to recreate a surface divide components row structure.

To get the number of items in each branch, simply use a list length component. To get the total number of branches, flatten this list and use another list length component. Then input to a VB component as follows. All lists need to be flattened in order to reassemble the tree structure.

Note: you may need to tell the component what type of data you are inputting. See below.

You can then jump into your script component and get to the task of recreating your tree. You need as many loops as the number of branches in your tree. In this case we only need one (the i loop). The j loop adds points to each branch.

The output should be a (possibly  simplified) but correct version of your original tree structure.

~ by ledatomica on March 27, 2010.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: