algorithmic modeling for Rhino
hi all!
I have a tree with lists of integers, R, and I use that to select branches from a second list, D. This is no problem, but I want to be able to keep the branches of D hierarchically organized under the original structure of R... how do I do this?
EDIT: I guess another way to put it is I want to insert the branches of Tree D into tree R, using the values in list R as corresponding indexes.
Thanks in advance
Oliver
Tags:
Hey Oliver,
Attached is a definition that does what you want. As far as lexical problems go, this was kind of tricky (although there's probably a better way).
First I used the Replace Paths component to give you the data structure you're looking for, simultaneously replicating the sub-path index as the single value per branch, so that you get a data structure like {a;b}(b), in your case {45;10}(10) {45;23}(23) {45;26}(26).
Then, a single line of C# does the rest.
A = D.Branch(R);
The access of R must be set to Item, and the access of D must be set to Tree. This means that D will be loaded into the C# component as one huge array (that's why it takes a little while to load when you open the file). Since R is set to Item, the component will run once for each of the 1150 branches in R. Each time, the branch with the value of R (10, 23, 26) will be populated with the corresponding branch {10}, {23}, {26} of the huge array D.
Hope that helps. When you get back maybe tell me what D and R actually mean?
N
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by