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 = 1 #distance between boxes offs = bsize+dist #offset of boxes num = 10 #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): for z in range(num): #myran = ran.randint(1,10) if (((x == 0) and (y == 0)) or ((x == 0) and (z == 0)) or ((y == 0) and (z == 0)) or ((x == num-1) and (y == num-1)) or ((x == num-1) and (z == num-1)) or ((y == num-1) and (z == num-1)) or ((x == 0) and (y == num-1)) or ((x == 0) and (z == num-1)) or ((y == 0) and (z == num-1)) or ((y == num-1) and (z == 0)) or ((x == num-1) and (z == 0)) or ((x == num-1) and (y == 0))): box = rs.AddBox(corners) rs.MoveObject(box, (x*offs,y*offs,z*offs))