What is the trick to have an exact tree restored?
In attached example the tree is restored to the branch structure but not when it comes to items.
The cylinders are result of moving and extruding the curves.
TREE real restore.gh (22.0 KB)
I don’t understand what you want to do. It works as expected Unflatten works by restoring by branch length and also the total tree count should be equal to the number of the flattened list.
Anyway, upload an example of what your expected result would be.
This problem can only be observed in a Rhino space.
Yes, structure is the same: 1 is 1, 4 is 4, but items are mis-matched.
Maybe there is too little definition to understand the process, but the initial circles were separated vertical from horizontal, move according to it’s own pattern and then merged back together but they are still the same items.
They match according to the list order. so again it works as expected.
You have 37 branches and 31 surfaces, you lost the order in a previous step.
Attach the previous part to fix it.
The definition is massive but, I think, I’ve extracted the essentials.
TREE real restore.gh (29.6 KB)
You can see that trees are identical before and after merge but even before the merge content of the tree branch is not the same.
Because you lost the order when you generated MOVED WALL and MOVED CEILING.
The problem is before that generation…
I know and I don’t know how to restore the order, hence this post.
I was thinking about assigning some keys/values to read them after transformations but I have no idea how to do it.
@Piotr study this silly example of how the Item Index component helps to return to the original tree…
good luck!
itemIndex.gh (35.7 KB)