import rhinoscriptsyntax as rs import random as ran rs.DeleteObjects(rs.AllObjects()) highest_hgt = 5 #highest point of the bridge lowest_hgt = -3 #lowest point of the bridge side_stair_hgt =1 #heigt of the stair bow on the sides sup_str_hgt = -3 #lowest point of the support structure cr_pt_dis = 10 #distance between crossing point and middle half_bridge_len = 17 #halv the lenght of the bridge in total side_stair_len= half_bridge_len-cr_pt_dis #length of the side stair cir_rad = 3 #radius of the circle podest at the end of the bridge up_stair_width = 3 #width of upper stair down_stair_width = 2 #width of lower stair side_stair_width = up_stair_width + 2*down_stair_width #width of side stair thick = 0.2 #thickness of the ramp sup_str_width = 0.1 #width of support structure ####################### #create rails ####################### #create line of upper bow upper_bow = rs.AddInterpCurve(([0,0,highest_hgt],[cr_pt_dis/2,0,highest_hgt-1], [cr_pt_dis,0,0]),3, start_tangent=([1,0,0]), end_tangent=[1,0,-1]) #create lines of support structure sup_str_1 = rs.AddInterpCurve(([cr_pt_dis,-up_stair_width/2,0],[half_bridge_len,-up_stair_width/2,sup_str_hgt]),3, start_tangent=([1,0,-1]), end_tangent=[1,0,0]) sup_str_2 = rs.AddInterpCurve(([cr_pt_dis,up_stair_width/2,0],[half_bridge_len,up_stair_width/2,sup_str_hgt]),3, start_tangent=([1,0,-1]), end_tangent=[1,0,0]) #create lines of lower bow low_bow_1 = line2=rs.AddInterpCurve(([0,(-up_stair_width/2-down_stair_width/2+sup_str_width/2),lowest_hgt],[cr_pt_dis,(-up_stair_width/2-down_stair_width/2),0]),3,start_tangent=([1,0,0]), end_tangent=[1,0,0.5]) low_bow_2 = line2=rs.AddInterpCurve(([0,(up_stair_width/2+down_stair_width/2-sup_str_width/2),lowest_hgt],[cr_pt_dis,(up_stair_width/2+down_stair_width/2),0]),3,start_tangent=([1,0,0]), end_tangent=[1,0,0.5]) #create line of side bow side_bow = line2=rs.AddInterpCurve(([cr_pt_dis,0,0],[half_bridge_len-side_stair_len/2,0,side_stair_hgt],[half_bridge_len,0,0]),3,start_tangent=([1,0,0.5]), end_tangent=[1,0,0]) ###################### #create ramps ###################### #create upper ramp rec1 = rs.AddRectangle([0,-up_stair_width/2,highest_hgt],thick,up_stair_width) rs.RotateObject(rec1,(0,0,highest_hgt),90, axis=(0,1,0)) rs.AddSweep1(upper_bow, [rec1], closed=True) #create first lower ramp rec2 = rs.AddRectangle([0,up_stair_width/2,lowest_hgt],thick,down_stair_width) rs.RotateObject(rec2,(0,0,lowest_hgt),90, axis=(0,1,0)) rs.AddSweep1(low_bow_1, [rec2], closed=True) #create second lower ramp rec3 = rs.AddRectangle([0,-down_stair_width-up_stair_width/2,lowest_hgt],thick,down_stair_width) rs.RotateObject(rec3,(0,0,lowest_hgt),90, axis=(0,1,0)) rs.AddSweep1(low_bow_2, [rec3], closed=True) #create side ramp rec4 = rs.AddRectangle([cr_pt_dis,-up_stair_width/2-down_stair_width,0],thick,side_stair_width) rs.RotateObject(rec4,(cr_pt_dis,0,0),90, axis=(0,1,0)) rs.AddSweep1(side_bow, [rec4], closed=True) #create support structure 1 rec5 = rs.AddRectangle([cr_pt_dis,-up_stair_width/2+sup_str_width/2,0],sup_str_width,sup_str_width) rs.RotateObject(rec5,(cr_pt_dis,0,0),90, axis=(0,1,0)) rs.AddSweep1(sup_str_1, [rec5], closed=True) #create support structure2 rec6 = rs.AddRectangle([cr_pt_dis,up_stair_width/2-sup_str_width/2,0],sup_str_width,sup_str_width) rs.RotateObject(rec6,(cr_pt_dis,0,0),90, axis=(0,1,0)) rs.AddSweep1(sup_str_2, [rec6], closed=True) ##mirror all objects #allobjs=rs.SelectedObjects(rs.AllObjects()) #rs.MirrorObjects(allobjs,[0,0,0],[0,1,1],copy=True)