Grasshopper

algorithmic modeling for Rhino

Hello,

 

can someone explain me what is wrong wit my code?

 

protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.Register_IntegerParam("Number", "No", "Node-Number");
pManager.Register_PointParam("Coordinate", "XYZ", "Node-Coordinate");
}

protected override void SolveInstance(IGH_DataAccess DA)
{
List<Int64> num = new List<long>();

for (int i = 1; i < 11; i++)
{
num.Add(i);
}

List<On3dPoint> Pnt = new List<On3dPoint>();

for (int i = 0; i < 10; i++)
{
On3dPoint point = new On3dPoint(i, i, i);
Pnt.Add(point);
}
DA.SetDataList(0, num);

DA.SetDataList(1, Pnt);

}

 

I get the node numbers, but I can't get the coordinates...

 

(Rhino4/Net3,5/Rhino_DotNET and GH-V0.8.0066)

 

Thank you in advance.

Views: 4638

Replies to This Discussion

You cannot use Rhino_DotNET inside a GHA library. Grasshopper no longer understands the types defined in Rhino_DotNET, you need to switch to RhinoCommon types:

List<int> num = new List<int>();

for (int i = 1; i < 11; i++)
{
  num.Add(i);
}

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

for (int i = 0; i < 10; i++)
{
  Point3d point = new Point3d (i, i, i);
  pnt.Add(point);
}
DA.SetDataList(0, num);

DA.SetDataList(1, pnt);

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thank you David. Ill switch to RhinoCommon.

If you have no idea what happens in this line, "List<Int64> num = new List<long>();", you're in deep trouble.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service