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 = 25 # 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) #gz = range(0,num**3,2) """ fibonacci = [0] a, b = 0, 1 while b < (num ** 3): fibonacci.append(b) a, b = b, a+b print fibonacci """ for i in range (num) : for j in range (num) : for p in range (num) : # nur bei geraden Zahlen #if (i in fibonacci) or (j in fibonacci) or (p in fibonacci): if ((i+j+p)%6) and ((i-j+p)%4) and ((i-j-p)%88): box = rs.AddBox (corners) rs.MoveObjects (box, (i*offs,j*offs,p*offs)) rs.ObjectColor (box, (i*(111/num),j*(150/num),p*(170/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)%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,p*offs )) else: box = rs.AddBox (corners) rs.MoveObject(box, (i*offs,j*offs,p*offs )) rs.ObjectColor (box, (225,0,0)) """ """ for i in range (num) : for j in range (num) : if ((i+j)%4) and ((i-j) %3): box = rs.AddBox (corners) rs.MoveObjects (box, (i*offs,j*offs,0)) """ rs.EnableRedraw(True) """ box = rs.AddBox (corners) rs.MoveObjects (box, (2*10,0,0)) box = rs.AddBox (corners) rs.MoveObjects (box, (3*10,0,0)) box = rs.AddBox (corners) rs.MoveObjects (box, (4*10,0,0)) """