That is by design.
A simplified tree actually is a ‘forest’: each tree has no common path with other trees. This case was handled originally, so that lists would not have to always be nested within a list of a single item. (when all branches start with 0, which they usually do). There is also the discrepancy of multiple items that should be grouped and yet have no common path, which happens with ‘forests’. This fixes both things.
You can see that the
th.tree_to_list() function has a second input. It’s the retrieval function. If all your paths start with ‘0’, then the default
lambda x: x will work best. If they all start with different numbers, then use
lambda x: x. Etc…
a = th.tree_to_list(x, lambda x: x)
for Robert McNeel & Associates
python_tree_simplify_design.gh (14.3 KB)