C# coding - div list of curves

Hi

I would like to divide these list of curves using c# but apparently only the last item has successfully output points. Pls tell me what went wrong?

divCrvs
div_curves_q.gh (6.5 KB)

code

If you set the input access to Item Access

private void RunScript(Curve curve, ref object A)
{
  Point3d[] pts;
  curve.DivideByCount(10, true, out pts);
  A = pts;
}

If you set it to List Access:

private void RunScript(List<Curve> curves, ref object A)
{
  var pts = new DataTree<Point3d>();
  for(var i = 0; i < curves.Count; i++)
  {
    Point3d[] points;
    curves[i].DivideByCount(10, true, out points);
    pts.AddRange(points, new GH_Path(i));
  }
  A = pts;
}


DivideByCount.gh (19.0 KB)

Thanks! Much appreciated.

This helped me too. Thanks !

1 Like