Tree_to_list() Problem?

Hi,
is there a problem with the tree_to_list() function in ghpythonlib.treehelpers? Take a look at the attached example. I tried to pass a tree with 60 surfaces in total to a Python script but I only managed to get access to 12 of the surfaces. What am I missing here?

If I pass the tree to this script as x_tree I would expect to get the complete tree back at the output a, but I don’t.

import ghpythonlib.treehelpers as th
x_list=th.tree_to_list(x_tree)
a=th.list_to_tree(x_list)

Any ideas?

cu
Flo

tree_to_list_problem.gh (215.8 KB)

Your input datatree is simplified (no common root branch).

Edited code:

import ghpythonlib.treehelpers as th

x_list=th.tree_to_list(x_t, retrieve_base=lambda x: x)

a=th.list_to_tree(x_list, False, source=[])

tree_to_list_problem_re.gh (219.3 KB)

This is a fairly common question, more info here:

Q&A on particular usages, such as with simplified trees

-Kevin

1 Like

Hi Kevin,
thanks for the link. It’s surprising that I never encountered this before.

cu
Flo