How to output a double[,] ? (like a tree object?)

Dear all,

In the c# component, I set an output named “y”, and

double [, ] mylist = new double [2,3];
and initiate mylist;
y = mylist;

but y is always a single list like double[], rather than a tree object double[,]

is there any way to set my output y to a tree list, or I have to arrange it using other component provided in grasshopper, I tried the later but I think it is a little bit trivial.

Probably the only working way would be to directly construct a DataTree from scratch.

If you want to output a tree, your only option is to create an actual DataTree. GH1 is not smart enough to convert nested arrays or multi-dimensional arrays into trees.

Thanks! is there a way to just output a 2d array?

Any data you output, if it isn’t already of type IGH_Goo, will be interpreted by Grasshopper and converted (if possible) into a known type. Anything which provides an IEnumerable interface will be converted into a collection. If you want to maintain your 2D array, you must wrap it into a GH_ObjectWrapper before outputting it, that will prevent GH from trying to inspect and convert it.

Many thanks! Good to know!:grinning: