Lines from Box corners to its center / C# /

Hello, I was successful in developing most part of the script, but somehow not able to join the points from box corner to its center, it thows an error "Error (CS1503): Argument 2: cannot convert from ‘Rhino.Geometry.Point3d[]’ to 'Rhino.Geometry.Point3d"
attaching grasshopper script and visual which I am looking to develop.

boxes.gh (4.5 KB)

Thankyou!

private void RunScript(int x, int y, int z, double xI, double yI, double zI, ref object Corners, ref object Centers, ref object Boxes, ref object Lines)
{
  var centers = new List<Point3d>();
  var corners = new DataTree<Point3d>();
  var lines = new DataTree<Line>();
  var boxes = new List<Box>();
  for(var i = 0; i < x; i++)
    for(var j = 0; j < y; j++)
      for(var k = 0; k < z; k++)
      {
         var xInterval = new Interval(i, i + xI);
         var yInterval = new Interval(j, j + yI);
         var zInterval = new Interval(k, k + zI);
         var box = new Box(Plane.WorldXY, xInterval, yInterval, zInterval);
         boxes.Add(box);
         var center = box.Center;
         centers.Add(center);
         foreach(var pt in box.GetCorners())
         {
           var path = new GH_Path(i, j, k);
           corners.Add(pt, path);
           lines.Add(new Line(pt, center), path);
         }
      }
  Corners = corners;
  Centers = centers;
  Boxes = boxes;
  Lines = lines;
}

Boxes.gh (3.8 KB)

1 Like

Thankyou!!!