import rhinoscriptsyntax as rs import random as ran #delete everything and start from scratch allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) bsize = 10 #side length of box dist = 1 #distance between boxes offs = bsize + dist #offset of boxes num = 30 #number of boxes in one row #create a box corners = [(0,0,0), (bsize,0,0), (bsize,bsize,0), (0,bsize,0), (0,0,bsize), (bsize,0,bsize), (bsize,bsize,bsize), (0,bsize,bsize)] for i in range(num): for j in range(num): for p in range(num): myran = ran.randint(0,9) if (myran > 2): if((i+j+p)%3) and ((i+j-p)%3) and ((i-j+p)%3) and ((i-j-p)%3): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs, j*offs,0)) """ for i in range(num): for j in range(num): if ((i+j)%3) and ((i-j)%3): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,0)) """