import rhinoscriptsyntax as rs import scriptcontext as sc import math import random as ran allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) #vector = rs.VectorCreate((0, 0, 0), (0, 1, 0)) #Line1 = rs.AddCurve([[0,10,0], [300,10,0]],3) #rs.OffsetCurve(Line1, vector, -10, None, 1) #rs.OffsetCurve(Line1, vector, -50, None, 1) seg = 40 rad = 15 rings = ran.randint(10,20) #off_dis = ran.randint(0, rad) cir1 = rs.AddCircle([0,0,0], rad) pts1 = rs.DivideCurve(cir1, seg, True, True) #rs.SelectedObjectGrips(cir1) #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))) #crv1 = rs.AddCurve((move1)) #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)) #pt2=rs.MoveObject(pts1[0],(0,10,0)) #pt3=rs.MoveObject(pts1[1],(0,15,0)) #pt4=rs.MoveObject(pts1[2],(5,0,0)) #rs.RebuildCurve(cir1, 3, 40) """ curves = [curve2] for i in range(rings): off_dis = ran.randint(0, 10) param = rs.CurveClosestPoint(curve2, [0,0,0]) normal = rs.CurveTangent(curve2, param) angle = rs.Angle([0,0,0], normal) [0] offset = rs.OffsetCurve(curve2, [0,0, angle],-i*off_dis) if offset: curves.append(offset[0]) """ curves=[] curve3=curve2 for k in range(rings): off_dis = ran.randint(1, 5) #param = rs.CurveClosestPoint(curve2, [0,0,0]) #normal = rs.CurveTangent(curve2, param) #angle = rs.Angle([0,0,0], normal) [0] curve3 = rs.OffsetCurve(curve2, [0,0, 5],-i*(off_dis/30)) curves.append(curve3) curve2=curve3 #print(curves) #rs.SelectObjects(curves) #print (len(curves)) zran = ran.randint(2,20) start = [0,0,0] end = [0,0,zran] #rs.ExtrudeCurve((curves[s],curves[s+1]), start, end) #zran = ran.randint(2,20) #downline = rs.AddLine([0,0,0], [0,0,-zran]) for s in range(len(curves)): if s