Treehelpers with simplify

Hi,
I’m trying to simplify tree before processing in ghPython. which causes only first branch is executed. Can somebody explain me why it is like that? I have selected ‘Tree Access’ on x input.

treehelpers_simplify.gh (8.1 KB)

Thanks.

1 Like

Hi Lukas,

this is expected and is designed to work this way. Let’s see from the beginning: a “simplified tree” is not a normal tree anymore, it is a “forest”. There is no base branch (“trunk”?) in common anymore, so paths represent distinct trees. Grasshopper components alone, in fact, usually do not create this type of forests.

To work with this type of “forest”, a base list in Python would always have to be created, to support these distinct routes. This is however unwelcome, because it would force scripting with one more level of item[]. Therefore, the functions by default automatically take only the first path and give out the result removed of the first branch. If you want, you can still work with forests, for example in the way that is shown below. There are appropriate arguments for both tree_to_list and list_to_tree functions.


treehelpers_simplify_with_base_and_retrievebase.gh (10.4 KB)

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

10 Likes

Great explanation, thanks.