[Solved] Do data trees contain the transformations?

grasshopper
unhandled
tree

(IVELIN PEYCHEV) #1

Assume I have done numerous transformations on some objects and I get the data tree, can I extract the transformations of particular branch?


(Michael Pryor) #2

You should track and collect the transforms in the same way as the geometry you transform (The X output on all transform components). Or do all the transforms first without the geometry, combine them in the compound transformation component, transform the geometry with one compound transform - then it will be easier to keep track of the transform data.


(IVELIN PEYCHEV) #3

Yeah, that is clear, but if you want to create a cluster give it to someone then he requires the transformation only of one branch to apply it to something else.

Or is it that data trees can gather only the objects after transformations have been applied?

I’m trying to figure out how useful data trees are with models other than Architectural Design.


(Michael Pryor) #4

Your thinking is correct that the data tree will just have the geometry. Data trees can hold any data but the transform data does not automatically come packaged with the geometry (because in the code transforms make a copy of the geometry as new). That is why I suggest to track the transformations as well, this way for a cluster you can also provide an “X” output if the transform data is needed. (This is what the GH components also do in code with their X outputs). So essentially, you will have two data trees that correspond. One of the geometry, one of the transformations. It would also be possible to put them in one data tree as 2 items branch (with something like merge or weave of the geometry and its transform data) but then the user will need to get each transform with a list item per branch.


(IVELIN PEYCHEV) #5

Ah, so the transformations are also considered objects to be stored in the data tree. Interesting idea. I just have to think in advance, if I’m going to need the transformations or not.

Thanks.


#6

Just some hours ago I dealt with a similar problem (storing transforms to be applied to other objects).

In the foillowing script, a C# component transforms some spheres internally, and it also outputs a list of the transforms to its Trx output so that the transforms can be applied also on the blue boxes. If the steps are not needed one can do like Michael said - combine them the entire list into one Transform using the Compound component.

transform_experiment.gh (14.7 KB)

// Rolf


(IVELIN PEYCHEV) #7

Thanks a lot for sharing Rolf, it’s great.