I have been trying for hours to create an empty DataTree matching an existing, non-empty DataTree. I could not find a component to do that - is there any component, that I missed, or maybe a simple trick on how to easily do that?
In order to solve this, I have created a very little Python script, that does “almost” exactly, what I want. But I got stuck on the last little thing. When I add “None” to the DataTree, it gets a < null > attached, instead of just an empty path.
from Grasshopper import DataTree
import System
tree = DataTree[System.Object]()
for path in x.Paths:
tree.Add(None, path)
a = tree
I get the desired result using a CleanTree component (as shown on the right), but I want to avoid this extra step and create the empty DataTree directly in GHPython.
Can you please help me on how to do that? It should really be a very minor addition/modification to the script.
Thank you, but that is not what I want. Your solution fills the DataTree with empty strings, but I want is the DataTree is actually empty - like shown on the right in my image.
Thanks a lot @Wiley - that’s now exactly what I was looking for. I tried “exactly” this before (well, obviously not really exactly) and it didnt work… but now I did it again it does.
The reason I need this empty tree is that I have two trees - one holding geometry and one holding transforms. By merging the transforms with the empty tree I can make sure the adressing is not mixed up by automatic branch “matching”. Now every transform goes to the correct geometry - although I am feeding all geometry and all transforms through only one transform geometry component.