import rhinoscriptsyntax as rs import random as ran allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) rs.EnableRedraw(False) #variablen bsize = 10 #Seitenlaenge der Box dist = 1 #Distanz zwischen den Boxen offs = bsize + dist #Verschiebung der Boxen num = 20 #Boxenanzahl in einer Reihe size = 6 #Groesse des Karos beim Karomuster asize = 400 #wo der naechste Block anfaengt fuer Feld 2 csize = 800 #wo der naechste Block anfaengt fuer Wuerfel 1 dsize = 1000 #wo der naechste Block anfaengt fuer Wuerfel 2 esize = 1200 #wo der naechste Block anfaengt fuer Wuerfel 3 fsize = 1400 #wo der naechste Block anfaengt fuer bonusaufgabe numw = 10 #num nur fuer Wuerfel #basic Box fuer Feld 1 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)] #Feld 1 for i in range(num): for j in range(num): if ((i+j)%size) and ((i-j)%size): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,0)) #basic Box fuer Feld 2 corners =[(asize,0,0),((asize + bsize),0,0),((asize + bsize),bsize,0),(asize,bsize,0), (asize,0,bsize),((asize + bsize),0,bsize),((asize + bsize),bsize,bsize),(asize,bsize,bsize)] #Feld 2 for i in range(num): for j in range(num): if not ((i+j)%size) or not ((i-j)%size): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,0)) #basic Box fuer Wuerfel 1 corners =[(csize,0,0),((csize + bsize),0,0),((csize + bsize),bsize,0),(csize,bsize,0), (csize,0,bsize),((csize + bsize),0,bsize),((csize + bsize),bsize,bsize),(csize,bsize,bsize)] #Wuerfel 1 for i in range(numw): for j in range(numw): for p in range(numw): if not ((i+j+p)%size) or not ((i+j-p)%size) or not ((i-j+p)%size) or not ((i-j-p)%size): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) #basic Box fuer Wuerfel 2 corners =[(dsize,0,0),((dsize + bsize),0,0),((dsize + bsize),bsize,0),(dsize,bsize,0), (dsize,0,bsize),((dsize + bsize),0,bsize),((dsize + bsize),bsize,bsize),(dsize,bsize,bsize)] #Wuerfel 2 for i in range(numw): for j in range(numw): for p in range(numw): if ((i+j+p)%size) and ((i+j-p)%size) or not ((i-j+p)%size) and ((i-j-p)%size): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) #basic Box fuer Wuerfel 3 corners =[(esize,0,0),((esize + bsize),0,0),((esize + bsize),bsize,0),(esize,bsize,0), (esize,0,bsize),((esize + bsize),0,bsize),((esize + bsize),bsize,bsize),(esize,bsize,bsize)] #Wuerfel 3 for i in range(numw): for j in range(numw): for p in range(numw): myran = ran.randint(0,9) if not (myran >=8): if not ((i+j+p)%size) and ((i+j-p)%size) or ((i-j+p)%size) and not ((i-j-p)%size): box = rs.AddBox(corners) rs.MoveObject(box, (i*offs,j*offs,p*offs)) #basic Box fuer bonus aufgabe corners =[(fsize,0,0),((fsize + bsize),0,0),((fsize + bsize),bsize,0),(fsize,bsize,0), (fsize,0,bsize),((fsize + bsize),0,bsize),((fsize + bsize),bsize,bsize),(fsize,bsize,bsize)] """ #Bonusaufgabe Versuch 1 for i in range(numw): for j in range(numw): for p in range(numw): if (i>=0)and(j==0)and(p==0) or (i==0)and(j>=0)and(p==0) or (i==(numw-1))and(j>=0)and(p==0) or (j==(numw-1))and(i>=0)and(p==0) or (i>=0)and(j==0)and(p==(numw-1)) or (i==0)and(j>=0)and(p==(numw-1)) or (i==(numw-1))and(j>=0)and(p==(numw-1)) or (j==(numw-1))and(i>=0)and(p==(numw-1)) or (i==0)and(j==0)and(p>=0) or (i==(numw-1))and(j==0)and(p>=0) or (i==0)and(j==(numw-1))and(p>=0) or (j==(numw-1))and(i==(numw-1))and(p>=0): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,p*offs)) """ #Bonusaufgabe Versuch 2 for i in range(10): for j in range(10): for p in range(10): box = rs.AddBox(corners) rs.MoveObjects(box, (i*offs,j*offs,p*offs)) if (0