import rhinoscriptsyntax as rs import random as ran #define variables and delete all former created objects allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) bsize = 10 #side lenght of box dist = 1 #distance between boxes offs = bsize + dist #offset of boxes num = 10 #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)] rs.EnableRedraw(False) for i in range (num): for j in range (num): for p in range (num): if (i==0 and (p==0 or j==0 or p==(num-1) or j==(num-1)) or j==0 and (p==0 or p==(num-1) or i==(num-1)) or p==0 and (j==(num-1) or i==(num-1)) or i==(num-1) and (j==(num-1) or p==(num-1)) or j==(num-1) and p==(num-1)): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) """ if ((i==0) and (p==0)): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((i==0) and (j==0)): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((p==0) and (j==0)): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((i==(num-1)) and (p==(num-1))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((i==(num-1)) and (j==(num-1))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((p==(num-1)) and (j==(num-1))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((i==(0)) and (p==(num-1))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((i==(num-1)) and (j==(0))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((p==(0)) and (j==(num-1))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((i==(num-1)) and (p==(0))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((i==(0)) and (j==(num-1))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) if ((p==(num-1)) and (j==(0))): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) """ rs.EnableRedraw(True)