algorithmic modeling for Rhino
I have 2 trees with a structure like this:
{4;0} {4;0}
{4;1} {4;1}
{5;0} {5;0}
{5;1} {5;1}
etc. etc.
their structure is the same, but they have different values. What I want to do is combine them so that the structure would be something like:
{4;0}
{4;1}
{4;2}
{4;3}
{5;0}
{5;1}
{5;2}
{5;3}
I tried the method here, but it didn't give me what I wanted, it was just tacking the new values onto the end, and not maintaining their paths. Any help would be appreciated. Thanks!
Tags:
Thanks Daniel,
That works in this specific example, but it doesn't work when it comes to trees where the number of branches is different. what I want is to be able to find the last {0;?} value in the first list and add on all of the {0;?} values from the second tree to that. So if the first tree's 0 values ended at {0;49}, it would take value {0;0} from the second tree and place it at {0;50} and so on.
Yes Andrew that did exactly what I needed, thank you. I currently only have one item in each branch but might need more later, what would change to make that work?
For geometry you could group the elements prior to the pshift and then ungroup after the merge... for non-geometric data you'd need some sort of a trick. Something like Daniel's approach could work - if it were me I'd use some python/c# script to do the equivalent of "group and ungroup" for non-geometric data. in python these are extremely easy to write - for the "group" it's just a = [x] (with list access set for the x input) and for the ungroup it's just a = x (with item access for the x input) - see the attached script for examples.
Incidentally the C# equivalents are also simple (if slightly less than python) - but may run ever so slightly faster:
Group: A = new object[]{x}; (with x given list access)
Ungroup: A = x; (with x given item access)
Thanks Andrew, I'll give that a shot.
So i tried this out. My tree branches consist of 2 items, a poly line and a string. The python ones worked up until ungrouping at which point, it seemed to lose the polyline, returning a null in that slot. However, the C# method worked perfectly. Thanks a lot!
If branches have only one element, that is the right way.
Today is not my day XD
Hello
You could also give a try to treesloth plugin. i believe with 2-3 (list compare, stack trees) components you ll get what you are after
best
alex
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by