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 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)] num = 15 for i in range (num): for j in range (num): for p in range (num): my_ran = ran.randint(0,9) if (my_ran > 3): if not((5 < i < 14) and (5 < j < 14) and (5 < p < 14)) and ((i%4) and (j%4) and (p%4)): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,p*offs)) rs.ObjectColor(box, (i*(255/num), j*(255/num), p*(255/num))) """ gz = range(0,num*num*num,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): if not (i in fibonacci) or (j in fibonacci) or (p in fibonacci): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,p*offs)) #rs.ObjectColor(box, (i*(255/num), j*(255/num), p*(255/num))) if not((0 < i < 9) and (0 < j < 9) and (0 < p < 9)) and not ((0 < i < 9) and (0 < j < 9) and not (0 < p < 9)): for i in range (num): for j in range (num): for p in range (num): my_ran = ran.randint(0,9) if (my_ran > 2): if ((i+j+p)%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.MoveObjects(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)%4) or ((i-j)%4): #gibt Rcaest einer Teilung wieder box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,0)) """