algorithmic modeling for Rhino
Hello!
I was wondering if there is a method for getting the items of a collection (Lists, Arrays, or even CurveList and so on) without having to loop through each of them and add it one by one.
Something like not having to do this:
CurveList cl = whateverCurveList;
List<Curve> myList = new List<Curve>();
foreach (Curve c in cl){myList.Add(c);}
A = myList;
Thanks in advance.
Cheers!
Tags:
Hi Miguel,
myList.AddRange()
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Exactly what I needed.
Thanks, David!
:-)
Hello Again,
Is there something similar for GH_DataTree? As far as I noticed, it only works for System.Collections, right?
Thanks!
GH_DataTree also has AddRange functions. You can also get the List(Of T) stored under a specific path, so you can use all the functions available on List(Of T).
Furthermore, GH_DataTree has a function called MergeTree, which is basically the same as AddRange, except it works on all branches and paths simultaneously.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Ok, David. I tried as well:
dataStructure1.AddRange(dataStructure2.AllData(), new GH_Path(whateverInt));
to change the paths my way.
Cheers!
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