import rhinoscriptsyntax as rs import random as ran allobjs=rs.AllObjects() rs.DeleteObjects(allobjs) bsize=10 dist=1 offs=bsize+dist num=10 #create a box corners = [(0,0,0), (10,0,0), (10,10,0), (0,10,0), (0,0,10), (10,0,10), (10,10,10), (0,10,10)] #my_c = rs.AddLine((0,0,0), (200,300,0)) linie erstellen #my_c = rs.AddCurve([[0,0,0], [100,200,0], [300,-200,0], [500,200,0], [700,-400,0]], 3) kurve erstellen #my_pts = rs.DivideCurve(my_c, 70, True, True) #for p in my_pts: # my_box = rs.AddBox(corners) # rs.MoveObject(my_box, p) boxen auf den punkten erstellen #my_c = rs.AddSpiral([0,0,0], [0,0,1000], 15,10, 100,50) spirale erstellen #my_pts = rs.DivideCurve(my_c, 300, True, True) #for p in my_pts: #my_box = rs.AddBox(corners) #rs.MoveObject(my_box, p) #boxen auf die spirale setzen #erstellen eines rechtecks plane = rs.WorldXYPlane() my_rect = rs.AddRectangle(plane, 200, 500) for i in range(200): #boxen im rechteck erstellen auf random xran = ran.randint(-100,400) yran = ran.randint(-200,600) zran = 0 ranscale = ran.uniform(1,6) #die boxen werden verschieden gross if not (rs.PointInPlanarClosedCurve([xran,yran,zran], my_rect, plane, 0)): my_box = rs.AddBox(corners) rs.MoveObject(my_box, [xran,yran,zran]) rs.ScaleObject(my_box, [xran,yran,zran], [1,1,ranscale])