import rhinoscriptsyntax as rs import random as ran # delete everything and start from scratch rs.DeleteObjects(rs.AllObjects()) # domino variables A = 2.8 # A = Module size (distance between columns) B = A/2 # B = Distance of columns to end of plate f_height = 0.5 # f_height = foundation height f_size = 0.8 # f_size = foundation edge size thick = 0.18 # thickness of all slabs hgt = 2.7 # height of room xcol = 1 # columns in x direction ycol = 2 # columns in y direction levels = 2 # number of floor plates # stair values s_width = 2.4 # s_width = stair total width pod_l = 1.8 # pod_l = depth of landing tt = 0.3 # length of steps th = 0.17 # initial rise setting thmax = 0.19 # maximum acceptable rise def make_curved_podeststair(curve, th=th, tt=tt, steps=40, thick=thick, s_width=s_width, pod_l=s_width/2, DC=24, P=8, A=0): pts = [[0,0,0]] for i in range(1,steps): #switch=ran.randint(0,9) if(not(i%DC)): ##DC: Direction Change th=-th pts.append([pts[-1][0]+pod_l,pts[-1][1],pts[-1][2]]) pts.append(pts[-1]) pts.append((pts[-1][0]+tt,pts[-1][1],pts[-1][2])) elif(not(i%P)): ##P: Podest pts.append((pts[-1][0]+pod_l,pts[-1][1],pts[-1][2])) pts.append((pts[-1][0]+tt,pts[-1][1],pts[-1][2])) elif(i==1) and (A>0): ##P: Erstes Podest pts.append([pts[-1][0]+A,pts[-1][1],pts[-1][2]]) pts.append([pts[-1][0],pts[-1][1],pts[-1][2]+th]) pts.append([pts[-1][0]+tt,pts[-1][1],pts[-1][2]]) else: ##Regular steps pts.append([pts[-1][0],pts[-1][1],pts[-1][2]+th]) pts.append([pts[-1][0]+tt,pts[-1][1],pts[-1][2]]) if th<0: ## stair ends going down: add a lower edgepoint pts.append([pts[-1][0],pts[-1][1],pts[-1][2]+th]) return_list = [] for i in range(-1,-len(pts),-2): return_list.append((pts[i][0], pts[i][1], pts[i][2]-thick)) pts.extend(return_list) pts.append([pts[0][0], pts[0][1], pts[0][2]-thick]) pts.append(pts[0]) s_outline = rs.AddPolyline(pts) path = rs.AddLine(pts[0],[pts[0][0], pts[0][1]+s_width/2, pts[0][2]]) shadow = rs.AddLine(pts[0],[return_list[0][0], return_list[0][1], pts[0][2]]) s_surf = rs.AddPlanarSrf(s_outline) rs.Command("_Flow _selID {} _Enter _selID {} _selID {} _Enter".format(s_surf[0], shadow, curve), False) profile = rs.FirstObject() stair = rs.OffsetSurface(profile, s_width/4, both_sides=True, create_solid=True) rs.DeleteObjects([s_surf[0], shadow, curve, path, s_outline, profile]) return(stair) #clover pattern: polyline made up of arcs will result in interesting patterns based on angle def make_clover(p_num, radius=3, angle=30, translation=[0,0,0]): c_points =[] cur_angle=0 for i in range(p_num): cur_angle=angle+cur_angle nextpoint = rs.VectorRotate([radius,0,0],cur_angle, [0,0,1]) c_points.append(nextpoint) cmd ="-_Polyline" for i in range(len(c_points)): cmd += " {},{},{} _Mode=Arc".format(c_points[i][0], c_points[i][1],c_points[i][2]) cmd +=" _Enter" rs.Command(cmd, False) curve=rs.FirstObject(False) rs.MoveObject(curve, translation) return(curve) # fantastic stairs designs rs.EnableRedraw(False) if 1: #clover stairs for i in range(6): if i<6: clover = make_clover(60, 5, 45, (20,32,0)) stair = make_curved_podeststair(clover,th=th, tt=tt, steps=200, thick=thick, s_width=s_width, pod_l=s_width, DC=400, P=300, A=0) rs.MoveObjects(stair, (i*8,i*3.5,0)) rs.RotateObjects(stair, (34,46,0), 180, axis=None, copy=True) if 0: #spirale stairs curve =rs.AddSpiral([0,0,0],[0,0,1], 0, turns=3, radius0=2, radius1=10) stair = make_curved_podeststair(curve,th=th, tt=tt, steps=150, thick=thick, s_width=s_width, pod_l=s_width/2, DC=250, P=250, A=0) curve =rs.AddSpiral([0,0,0],[0,0,1], 0, turns=3, radius0=10, radius1=2) stair = make_curved_podeststair(curve,th=th, tt=tt, steps=150, thick=thick, s_width=s_width, pod_l=s_width/2, DC=250, P=250, A=0) rs.MoveObjects(stair, (5,0,0)) curve =rs.AddSpiral([0,0,0],[0,0,1], 0, turns=3, radius0=2, radius1=10) stair = make_curved_podeststair(curve,th=th, tt=tt, steps=150, thick=thick, s_width=s_width, pod_l=s_width/2, DC=250, P=250, A=0) rs.MoveObjects(stair, (10,0,0)) curve =rs.AddSpiral([0,0,0],[0,0,1], 0, turns=5, radius0=10, radius1=2) stair = make_curved_podeststair(curve,th=th, tt=tt, steps=150, thick=thick, s_width=s_width, pod_l=s_width/2, DC=250, P=250, A=0) rs.MoveObjects(stair, (15,0,0)) curve =rs.AddSpiral([0,0,0],[0,0,1], 0, turns=5, radius0=2, radius1=10) stair = make_curved_podeststair(curve,th=th, tt=tt, steps=150, thick=thick, s_width=s_width, pod_l=s_width/2, DC=250, P=250, A=0) rs.MoveObjects(stair, (20,0,0)) """ curve =rs.AddSpiral([0,0,0],[0,0,1], 0, turns=5, radius0=10, radius1=2) stair = make_curved_podeststair(curve,th=th, tt=tt, steps=150, thick=thick, s_width=s_width, pod_l=s_width/2, DC=250, P=250, A=0) rs.MoveObjects(stair, (25,0,0)) curve =rs.AddSpiral([0,0,0],[0,0,1], 0, turns=5, radius0=2, radius1=10) stair = make_curved_podeststair(curve,th=th, tt=tt, steps=150, thick=thick, s_width=s_width, pod_l=s_width/2, DC=250, P=250, A=0) rs.MoveObjects(stair, (30,0,0)) """ rs.EnableRedraw(True)