import rhinoscriptsyntax as rs import random as ran #deleting and starting from scratch allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) bsize = 10 #side length of box dist = 5 #distance between boxes offs = bsize+dist #offset of boxes num =40 #parameters of the 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)] #gotta be fast rs.EnableRedraw(False) #creating the box and the pattern for x in range(num): for y in range(num): #corners if (x<5 and y<1) or (y<5 and x<1) or (y>(num-6) and x<1) or (y>(num-2) and x<5) or (x>(num-6) and y<1) or (x>(num-2) and y<5) or (x>(num-2) and y>(num-6)) or (x>(num-6) and y>(num-2)): box = rs.AddBox(corners) rs.MoveObject(box, (x*offs,y*offs,0)) #diagonals if x == y: box = rs.AddBox(corners) rs.MoveObject(box, (x*offs,y*offs,0)) if y == (num - 1 - x): box = rs.AddBox(corners) rs.MoveObject(box, (x*offs,y*offs,0)) #horizontal and vertical if ((x == (num/2)) or x == (num/2-1)) and y%3: box = rs.AddBox(corners) rs.MoveObject(box, (x*offs,y*offs,0)) if ((y == (num/2)) or y == (num/2-1)) and x%3: box = rs.AddBox(corners) rs.MoveObject(box, (x*offs,y*offs,0))