import rhinoscriptsyntax as rs import random as ran #delete everything and start from scratch allobjs = rs.AllObjects () rs.DeleteObjects (allobjs) bsize = 10 #sidelength of box dist = 1 #distance between boxes offs = bsize + dist #offset of boxes num = 10 #number of boxes #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): myran= ran.randint (0,9) if (myran>5): box = rs.AddBox (corners) rs.MoveObject (box, (i*offs, j*offs, p*offs)) rs.ObjectColor (box, (255,0,0)) rs.ObjectColor (box, (i*(280/num),j*(267/num),p*(254/num))) """ 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)%4) and ((i-p-j)%4) and ((i-p+j)%4) and ((i+p-j)%4): box = rs.AddBox (corners) rs.MoveObjects (box, (i*offs,j*offs,p*offs)) else: box = rs.AddBox (corners) rs.MoveObject (box, (i*offs, j*offs, p*offs)) rs.ObjectColor (box, (255,0,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)) """ rs.EnableRedraw(True)