# python 2 import rhinoscriptsyntax as rs import random as ran allobjs = rs.AllObjects() #alle objekte in einer Variable hinein Plaziert rs.DeleteObjects(allobjs) #delete everything and start from scratch bsize = 10 #side length of box dist = 1 #distance between boxes offs = bsize + dist # offstet of boxes num = 30 # 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)] #schleife machen statt ganz oft aufschreiben rs.EnableRedraw(False) # damit man das nicht einzeln zeichnet sondern auf einmal gz= range (0,num**3,2) #gz= geradezahlen fibonacci = [0] a, b = 0, 1 while b < (num ** 3): a, b = b, a+b print fibonacci for i in range (num): for j in range (num): for p in range (num): myran = ran.randint(0,9) if (i in fibonacci) or (j in fibonacci) or (p in fibonacci): #if (myran > 7): #if (i + j + p) %6: box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) rs.ObjectColor(box,(i*(255/num),j*(255/num),p*(255/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) %3) and ((i + j - p)%3) and ((i - j - p)%3): box = rs.AddBox(corners) rs.MoveObject(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,0)) # farbe bei den boxen machen bei den fehlenden """ """ for i in range (num): for j in range (num): if ((i + j) %3) and ((i - j)%3): # not ((1 < i <= 8) or (2 < j <= 4)): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,0)) """ rs.EnableRedraw(True)