Grasshopper

algorithmic modeling for Rhino

Lists show up as System.Collection.Generic.List in C# button output

Hi.

Inside a C#-Script button am generating several Point lists I want to add them to a tree and use the in Grasshopper.

Code-snippets:

DataTree<List<Point3d>> output = new DataTree<List<Point3d>>();

// inside a for loop:

List<Point3d> curveA = new List<Point3d>();

List<Point3d> curveB = new List<Point3d>();

....  fill the lists ...

// add to tree

int[] branchPath = new int[2] {k, 0};
output.Add(curveA, new GH_Path(branchPath));
branchPath[1] = 1;
output.Add(curveB, new GH_Path(branchPath));

.....

Instead of giving me a tree I can work with, the tree contains 2 System.Collection.Generic.List .. which are not recognised in Grasshopper. The values are not reachable...

If I skip the tree and return only one list, it works fine...

Any thoughts?

Cheers from the Switch the LampiOn Workshop in Trier

Views: 1423

Replies to This Discussion

I found a quick fix.

A new c#-script with:

private void RunScript(List<object> x, object y, ref object A)
  {
    if(x.Count > 0)
      A = x[0];
  }

now the tree is ok...

not very elegant, and probably not very correct, but it works...

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service