import rhinoscriptsyntax as rs import scriptcontext as sc import math import random as ran allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) rs.EnableRedraw(enable=False) # Anmerkug: # Sollte beim Laufen des Codes ein Fehler auftreten bzw. die Ringe des Kraters # komisch aussehen, bitte nochmals laufen lassen! Löst sich von selbst! #### # all changable Parameters: a = 250 # Ground circle radius tiefe = -15 # Ground circle thickness # Second Plane can be disabled by "if 0:" in the code! (87) b = 500 # lower plane width (render/environment) tiefe2 = -1 # lower plane thickness (render/environment) rings = 35 # Amount of rings on the ground | #rings = ran.randint(20,35) b_hgt = 120 # builing height in the center (Maß bevor der Planet Radius abgezogen wird zusätzlich!) aa = 16 # builing length bb = 8 # builing width offset = 1.5 # Sockel Breite seam = 8 # Sockelhöhe planet_rad = 50 # Planet radius planet_hgt = 150 # distance of Planet on the z-axis sky_cir_dis = 200 # distance outer planet ring ring_width = -50 # width of outer planet ring #### # Crater Ring Creation: seg = 40 # Inner Cicle Segments, don't change rad = 35 # Radius of Inner Circle, don't change cir1 = rs.AddCircle([0,0,0], rad) pts1 = rs.DivideCurve(cir1, seg, True, True) #print(pts1) crv_pts=[] for i in range(seg): xran = ran.randint(0,6) yran =ran.randint(0,6) crv_pts.append(rs.MoveObject(pts1[i],(xran,yran,0))) #print(crv_pts) curve=rs.AddCurve(crv_pts) curve2=rs.CloseCurve(curve,tolerance=10) #Hauptkurve rs.RebuildCurve(curve2,point_count=seg) rs.DeleteObjects((cir1,curve)) curves=[] curve3=curve2 for k in range(rings): off_dis = ran.randint(1, 5) curve3 = rs.OffsetCurve(curve2, [0,0, 5],-i*(off_dis/30)) curves.append(curve3) curve2=curve3 zran = ran.randint(2,20) start = [0,0,0] end = [0,0,zran] # Extrude Crater Rings: for s in range(len(curves)): if s