algorithmic modeling for Rhino
Good evening,
Can somebody help me, cast IGH_Goo to Integer?
my code(C#) is below,
GH_Structure<IGH_Goo> Tree = new GH_Structure<IGH_Goo>();
DA.GetDataTree<IGH_Goo>(0, out Tree);
GH_Structure<IGH_Goo> TreeOut = new GH_Structure<IGH_Goo>();
switch (S) {
case 0:
for (int i = 0; i < (int) Tree.get_DataItem(0); i++)
{
TreeOut.Append(null, new GH_Path(0));
}
break;
case 1:
for (int i = 0; i < Tree.Branches.Count; i++) {
TreeOut.Append(null, Tree.get_Path(i));
}
break;
and so on.....
}
I tried to convert IGH_Goo to Integer, but It will not work.
not only
(int) Tree.get_DataItem(0)
but also
Convert.ToInt32(Tree.get_DataItem(0))
won't work.
How can I make it??
Tags:
GH_Convert.ToInt32
it will perform all internally defined conversions (there's a lot of them) from types to integers. If you know you have a GH_Integer, then you can cast directly:
DirectCast(goo, GH_Integer).Value
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by