##Hausuebung 02####### ##Michael Mueggenburg# ##Gruber 03########### #importieren von rhinoscriptsyntax und random import rhinoscriptsyntax as rs import random #id's aller objekte erfassen und vorhanden objekte bei befehlausfuehrung loeschen allRhinos = rs.AllObjects() rs.DeleteObjects( allRhinos ) rs.EnableRedraw(0) #koordinatenraum und koordinaten definieren coords = [] for i in range(-8,16): for j in range(-5, 14): for k in range(-10, 7): x = i+k y = j z = k+y*x if random.uniform(0,100) < 50: z = z+60 x = x+15 if x > 30: x += 20 z=y*3 if y > 8: y += y*x x = x+9 cor = [x, y, z] coords.append( cor ) #punkte in rhino erstellen points = rs.AddPoints( coords ) #punkte in referenzraum faerben/loeschen for pnt in points[3000:5000]: rs.ObjectColor( pnt, [200,20,0]) for pnt in points[0:2000]: rs.ObjectColor( pnt, [200,200,0]) random.shuffle (cor) for pnt in points[5500:6500]: rs.DeleteObjects(pnt) #kurven hinzufuegen rs.AddCurve( coords, 3)