import rhinoscriptsyntax as rs import random as ran # delete everything and start from scratch rs.DeleteObjects(rs.AllObjects()) ############################################################################## # domino variables ############################################################################## A = 5 # A = Module size (distance between columns) B = A/3 # 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 = 2 # columns in x direction ycol = 3 # columns in y direction levels = 3 # 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 # function to create a box at an insertion point def make_box(insertion = (0,0,0), xsize = 10, ysize=10, zsize=10): corners = [(0,0,0), (xsize,0,0), (xsize,ysize,0), (0,ysize,0), (0,0,zsize),(xsize,0,zsize),(xsize,ysize,zsize),(0,ysize,zsize)] box = rs.AddBox(corners) rs.MoveObject(box, (-xsize/2,-ysize/2,0)) rs.MoveObject(box, insertion) return(box) ################################################################################ # make_curved_podeststair(curve, th, tt, steps, thick, s_width, pod_l, DC, P, A) # # stair with landings and up and down changes along a curve ################################################################################ # Arguments / Variables: # start = starting point # th = tritt hoehe / rise (float) # tt = tritt tiefe / tread depth (float) # steps = anzahl stufen / number of steps (int) # thick = thickness of stair (below tread) (float) # s_width = breite der stufen / stair width (float) # pod_l = podest laenge / depth of landing (float) # DC = direction change every DC steps (int) # P = podest / landing every P steps (int) # A = Antrittpodest / first landing, if 0 no landing is created (float) ################################################################################ rs.EnableRedraw(False) # function to create curved podesttstair def make_curved_podeststair(curve, th=th, tt=tt, steps=40, thick=thick, s_width=s_width, pod_l=s_width/2, DC=48, P=12, 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) plane = rs.WorldXYPlane() rad_c = ran.randint(10, 30) circle = rs.AddCircle(plane, rad_c) seg = ran.randint(10, 16) c_points = rs.DivideCurve(circle, seg, create_points=True, return_points=True) # create stairs on each point of the circle for i, pt in enumerate(c_points): spiral_curve = rs.AddSpiral( pt, # base point [pt[0], pt[1], pt[2] + 10], # axis point 0, # start of the radius 10, # end of the radius 3 # turns ) # create stairs make_curved_podeststair( curve=spiral_curve, th=th, tt=tt, steps=240, thick=thick, s_width=s_width, pod_l=s_width / 2, DC=80, P=20, A=0 ) rs.EnableRedraw(True)