algorithmic modeling for Rhino
Hi,
I have two collections of Breps as shown in the attached image. (One contains 1 object the other one two). Both are plugged into the x input of the second component. Inside this component I would like to be able to construct either a Tree with two branches or a List<ListBrep>> where one List contains one object and the other two.
However, Grasshopper seems to flatten whatever it gets in x to just one list that lost the hierarchy that I mentioned above.
When x is set to item access - the following does not work:
private void RunScript(object x, ref object A)
{IEnumerable objEnum = x as IEnumerable;
foreach (object item in objEnum)
{
IEnumerable enumerable = item as IEnumerable;
foreach (object obj in enumerable)
{
DoSomething((Brep) obj));
}
}...}
Similar for List access.
With Tree access x becomes a tree with one branch and three objects.
Is there any way to get the above mentioned hierarchy without creating a tree structure before the Breps get plugged into x?
Thanks a lot in advance,
Tim
Tags:
Hi Tim,
If the paths of those two lists are the same, then they will be merged inside the x parameter before the script even gets a chance. I'd use the [Entwine] component to create this tree, no scripting required.
--
David Rutten
david@mcneel.com
Tirol, Austria
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
© 2025 Created by Scott Davidson.
Powered by