how to specify the distance between points in the row and points in the column at a grid.
Also, how to change the placement or specify the placement of the starting point, which always starts the grid from (0,0,0). Using rhino/python
row = 2
col = 2
for i in range(0,row):
for j in range(0,col):
points = rs.AddPoint(i, j, 0)
Currently you’re looping twice through a range from 0 to your rows or columns number.
You can either multiply i and/or j by a step value to specify a distance, or simply use a stepped range instead.
step = 5
for i in range(0, row, step):
print i # 0, 5, 10, 15, etc.
import rhinoscriptsyntax as rs
spt=rs.GetPoint("Pick or key in start point")
if spt:
cell_size=rs.GetReal("Grid cell size?",minimum=0)
if cell_size and cell_size>0:
count=rs.GetInteger("Number of cells?",minimum=2)
if count:
rs.EnableRedraw(False) #comment out if you want to see the grid draw
for i in range(count+1):
for j in range(count+1):
rs.AddPoint([spt.X+i*cell_size,spt.Y+j*cell_size,0])
(makes a square grid with square cells, add separate X,Y values to have a rectangular grid/cell size…)