import rhinoscriptsyntax as rs import random as ran import fantastic_stairs_lib as fs reload(fs) rs.DeleteObjects(rs.AllObjects()) if 0: #random spiral with ramp curve= fs.make_random_spiral(10,8,10) len_c= rs.CurveLength(curve) tothgt = len_c*0.06 fs.make_curved_ramp(curve, tothgt) module = 6 length_fromstart = module while length_fromstart < len_c: point = rs.CurveArcLengthPoint(curve, length_fromstart) m_l = rs.AddLine(point, [point[0], point[1], length_fromstart*0.06-fs.thick/2]) rs.AddPipe(m_l, 0, 0.1) length_fromstart += module if 1: ###random spiral with stairs and podests #curve = fs.make_random_spiral(10,8,20) #curve = fs.make_random_spiral(10, 20, 30, 2,300) curve = rs.AddSpiral([0,0,0], [0,0,10], 0, 3, 5,30) len_c= rs.CurveLength(curve) An=0 P=12 mods = (len_c-An) / (P*fs.tt+fs.pod_l + fs.tt) steps = int(mods*P)+1 fs.make_curved_podeststair(curve, steps=steps, pod_l=fs.pod_l, DC=steps+1, P=P, An=An) i = 1 len_fromstart = An+P*fs.tt+fs.pod_l/2 while (len_fromstart < len_c): point = rs.CurveArcLengthPoint(curve, len_fromstart) m_l=rs.AddLine(point, [point[0],point[1],i*P*fs.th-fs.thick]) rs.AddPipe(m_l,0,0.1) pod_b= ran.randint(5,20) (box1, line1)=fs.make_box_wline([point[0],point[1],i*P*fs.th-fs.thick], fs.pod_l, pod_b, fs.thick) param = rs.CurveClosestPoint(curve, point) normal = rs.CurveTangent(curve, param) angle = rs.Angle([0,0,0], normal)[0] rs.RotateObject([box1, line1], [point[0],point[1],i*P*fs.th-fs.thick], angle, [0,0,1]) i = i+1 len_fromstart += P*fs.tt+fs.pod_l + fs.tt rs.DeleteObject(m_l) rs.DeleteObject(curve) #curve = rs.AddSpiral([0,0,0], [0,0,10], -5, 5, 2,15) #curve = fs.make_random_spiral(5, 40, 50, 100,300)