C#_Grid and Triangular Lines

Hello,
I have grid of point trying to connect them diagonally in one or two directions. I have attach the reference image.
I am stuck again!

List<Point3d> pts = new List<Point3d>();
List<Line> lines = new List<Line>();
int scl = 5;
int cols = 10;
int rows = 10;
for(double y = 0; y < rows*scl; y+= scl){
  for(double x = 0; x < cols * scl; x += scl){
    pts.Add(new Point3d(x, y, 0));
    lines.Add(new Line(x,0,0,0,y,0));
    // lines.Add(new Line(x+1, 0, 0, 0, y + 1, 0));
  }
}
A = pts;
B = lines;

Thank You!

triangular%20grid
aatriangular%20grid

See attached (includes a challenge for the brave).

PS: For that type of things always use DataTrees (or [,], stuff if you want to stay a bit GH neutral )

PointGrids_EntryLevel_V1.gh (9.8 KB)

1 Like