import rhinoscriptsyntax as rs import random as ran import fantastic_stairs_lib as fs #reload(fs) rs.DeleteObjects(rs.AllObjects()) #fs.make_domino # library kann ich nicht importieren, bzw funktioniert es nicht. #!!! ### Auch wenn es nicht mit der lib funktioniert, wollte ich beim Video mitgemacht ### #!!! #Spirle – Linien immer auf Bodeebene: #crv = fs.make_random_spiral(15, 3, 5) #fs.make_curved_stair(crv) whereto = [0,5,5] angle = 10 (box1, line1) = fs.make_boxwline([0,0,0], 1.2, 1.2, 0.2, 1) (box2, line2) = fs.make_boxwline(whereto, 1.2, 1.2, 0.2, 1) rs.RotateObjects([box2, line2], whereto, angle, [0,0,1]) # Linien verbinden: #pts1 = rs.CurvePoints(line1) #pts2 = rs.CurvePoints(line2) #rs.AddLine(pts1[1], pts2[1]) curve = fs.blend_curves(line1, line2, 1) (st_crv, tothgt) = fs.curve_to_stairline(curve) len_c = rs.CurveLength(st_crv) #Variate 3: (steps, th) = fs.calculate_steps_height(tothgt) An = 0 tt = (len_c - An / steps) if tt>0.32: tt = fs.tt p = steps / 2 p = 4 # Podest nach 4 Stufen pod_l = fs.calculate_podlen(len_c, tt, steps, P, An) print "stair values (length, thread height, thread depth, steps)", len_c, th, tt, steps fs.make_curved_podeststair(st_crv, steps=steps, th=th, tt=tt, pod_l=pod_l, P=P, An=An, DC=steps+1, s_width = 1.2) #Variante 1: #steps = int(len_c / fs.tt) #tt = len_c/steps #th = tothgt/steps #Variate 2: #steps = int(tothgt/fs.th) #th = tothgt/steps #tt = len_c/steps #Ramp Example: 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.AdddPipe(m_l, 0, 0.1) length_fromstart += module #Stair example: curve = fs.make_random_spiral(10, 8, 10) len_c = rs.CurveLength(curve) An = 0 p = 8 mos = (len_c-An) / (P*fs.tt + fs.pod_l + fs.tt) steps = int(mods*P) + 1 fs.make_curved_podeststair(curve, steps=steps, po_l=pod_l, DC=steps+1, P=P, An=An) i = 1 length_fromstart = An + P*fs.tt + fs.pod_l/2 while length_fromstart <= len_c: point = rs.CurveArcLengthPoint(curve, length_fromstart) m_l = rs.AddLine(point, [point[0], point[1], i*p*fs.th- fs.thick]) rs.AdddPipe(m_l, 0, 0.1) (box1, line1) = fs.make_box_wline([point[0], point[1], i*p*fs.th- fs.thick], fss.pod_l, 1.2,8.2, fs.thick) param = rs.CurveClosestPoint(curve, point) normal = rs.CurveTangent(curve, param) t_angle = rs.Angle([0,0,0], normal) [0] rs.RotateObjects([box1, line1], [point[0], point[1], i*p*fs.th- fs.thick], angle, [0,0,1]) i = i+1 length_fromstart += P*fs.tt + fs.pod_l/2 + fs.tt