Hello
I understand you work on Visual Studio and that maters as I can summarize like that
in Grasshopper with C# => use DataTree
in VisualStudio with C# => use GH_structure
Culebra has some very nice tools
Do to the opposite, it is quite trivial to change my example with a List<List<>>
public static DataTree<int> GH_Structure_Int_to_DataTree(GH_Structure<GH_Integer> gh_int)
{
DataTree<int> dt = new DataTree<int>();
IList<List<GH_Integer>> lst_lst_goo = gh_int.Branches;
for (int i = 0; i < lst_lst_goo.Count; i++)
{
GH_Path path = new GH_Path(i);
foreach (IGH_Goo goo in lst_lst_goo[i])
{
int data;
if (goo.CastTo<int>(out data))
{
dt.Add(data, path);
}
}
}
return dt;
}
Hello
I gave you an example to adapt for tour project.
As it is a static method (not a class) you must add it in a static class for example in the Culebra static class GHSupport.
So add in your project the GHSupport.cs
Add the method I gave you, tweak it in order to have a list of list, something like this
public static class GHSupport
{
public static List<List<<int>> GH_Structure_Int_to_ListList(GH_Structure<GH_Integer> gh_int)
{
List<List<int>> listlist = new List<List<int>>();
IList<List<GH_Integer>> lst_lst_goo = gh_int.Branches;
for (int i = 0; i < lst_lst_goo.Count; i++)
{
List<int> list = new List<int>();
foreach (IGH_Goo goo in lst_lst_goo[i])
{
int data;
if (goo.CastTo<int>(out data))
{
list .Add(data);
}
}
listlist .Add(list);
}
return listlist;