import rhinoscriptsyntax as rs import random as ran import fantastic_stairs_lib as fs rs.DeleteObjects(rs.AllObjects()) rs.EnableRedraw(False) #############VID2 - Rampe############# """ curve = fs.make_random_spiral(10,5,10) len_c = rs.CurveLength(curve) tothgt = len_c * 0.06 fs.make_curved_ramp(curve,tothgt) module = 6 length_frs = module while length_frs < len_c: point = rs.CurveArcLengthPoint(curve, length_frs) m_l = rs.AddLine(point, [point[0], point[1], length_frs*0.06-fs.thick/2]) rs.AddPipe (m_l, 0, 0.1) length_frs += module """ #############VID2 - Treppe############# curve = rs.AddSpiral([0,0,0],[0,0,1],1,4,10,50) len_c= rs.CurveLength(curve) An=0 P=18 mods = (len_c-An) / (P*fs.tt+fs.pod_l + fs.tt) steps = int(mods*P) 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.7) (box1, line1)=fs.make_box_wline([point[0],point[1],i*P*fs.th-fs.thick],fs.pod_l,8.2,fs.thick) param = rs.CurveClosestPoint(curve, point) normal = rs.CurveTangent(curve, param) 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 len_fromstart += P*fs.tt+fs.pod_l + fs.tt rs.DeleteObject(line1) """ #############VID2 - Treppenverbindung zwischen Dominos############# def make_v_grid(x_cnt,z_cnt,xsize,zsize,l_len): pts=[] lines=[] for i in range(x_cnt): for j in range(z_cnt): lines.append(rs.AddLine([i*xsize,0,j*zsize],[i*xsize,l_len,j*zsize] )) pts.append(rs.AddPoint([i*xsize,0,j*zsize])) return(pts,lines) rs.EnableRedraw(False) x_cnt, z_cnt, xsize, zsize = 3, 5, 4.0, 3.0 l_len = 1.0 dist_x, dist_y, dist_z = 20, 20, 0 angle=ran.uniform(90,180) (pts1, lines1) = make_v_grid(x_cnt,z_cnt,xsize,zsize,l_len) rs.RotateObjects(pts1, [0,0,0], angle, [0,0,1]) rs.RotateObjects(lines1, [0,0,0], angle, [0,0,1]) rs.MoveObjects(pts1, (dist_x, dist_y, dist_z)) rs.MoveObjects(lines1, (dist_x, dist_y, dist_z)) (pts2, lines2) = make_v_grid(x_cnt,z_cnt,xsize,zsize,l_len) ptl1 = range(0, len(pts1)) ptl2 = range(0, len(pts2)) crv_list = [] while len(ptl1)>0: r_init = ran.randint(0,len(ptl1)-1) r_end = ran.randint(0,len(ptl2)-1) init= lines1[ptl1[r_init]] end = lines2[ptl2[r_end]] ptl1.pop(r_init) ptl2.pop(r_end) crv_list.append(fs.blend_curves(init,end,2)) for curve in crv_list: (st_crv, tothgt) = fs.curve_to_stairline(curve) len_c = rs.CurveLength(st_crv) if abs(tothgt) <=zsize: fs.make_curved_ramp(st_crv, tothgt) else: (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 pod_l=fs.calculate_podlen(len_c, tt, steps, P, An) print "stair values (length, tread height, tread 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) result = fs.make_domino(xsize, xsize/3, thick=fs.thick, hgt=zsize-fs.thick,levels=z_cnt, xcol=x_cnt,ycol=fs.ycol) for o_list in result: rs.MoveObjects(o_list,[0,-(fs.ycol-1)*xsize-fs.f_size/2,-(fs.f_height+fs.thick)]) co_list= rs.MirrorObjects(o_list,[0,0,0], [dist_x,0,0], copy=True) rs.MoveObjects(co_list,[dist_x-(x_cnt-1)*xsize, dist_y, dist_z]) rs.RotateObjects(co_list,[dist_x, dist_y, dist_z],(angle-180), [0,0,1]) """