import rhinoscriptsyntax as rs import random as ran #delete everthing and start from scratch allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) # dom-ino variables: A = 5.0 # A = Module size distance between columns B = A/3 # B= distance of columns to end of plate thick = 0.2 # 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 f_height = 0.5 # foundation height f_size = 0.8 # foundation edge size # derived values: center_pt = [A*(xcol-1)/2, A*(ycol-1)/2, f_height] #insertion point of floor plate p_width = A*(xcol-1) + 2*B #width of floor plate (x) p_length = A*(ycol-1) + f_size #lenght of floor plate (y) def make_box(insertion=[0, 0, 0], xsize=10, ysize=10, zsize=10): # create a box 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 # Function to create a field of foundations def make_foundations(A=5.0, f_size=0.8, f_height=0.5, xcol=2, ycol=3): fns = [] for i in range(xcol): for j in range(ycol): fns.append(make_box([i * A, j * A, 0], f_size, f_size, f_height)) return fns # Function to create a field of columns def make_columns(A=5.0, level=0.7, thick=0.2, hgt=3.0, xcol=2, ycol=3): cls = [] for i in range(xcol): for j in range(ycol): cls.append(make_box([i * A, j * A, level], thick, thick, hgt)) return cls ########################################################################### # Building the Structure ########################################################################### f_list = [] # List of foundations c_list = [] # List of columns p_list = [] # List of plates w_list = [] # List of walls # layers rs.AddLayer("foundation") rs.LayerColor("foundation", (155, 48, 255)) rs.AddLayer("columns") rs.LayerColor("columns", (60, 220, 60)) rs.AddLayer("plates") rs.LayerColor("plates", (60, 60, 220)) rs.AddLayer("facade") rs.LayerColor("facade", (200, 60, 60)) rs.EnableRedraw(False) # Building each level of the domino structure for i in range(levels): center_pt[2] = f_height + i * (thick + hgt) level = f_height + thick + (i - 1) * (hgt + thick) # create foundations on the first level if i == 0: rs.CurrentLayer("foundation") f_list = make_foundations(A, f_size, f_height, xcol, ycol) else: rs.CurrentLayer("columns") c_list.extend(make_columns(A, level, thick, hgt, xcol, ycol)) # create floor plates rs.CurrentLayer("plates") p_list.append(make_box(center_pt, p_width, p_length, thick)) rs.CurrentLayer("facade") def make_hor_facade(insertion=[0, 0, 0], facadexsize=0.2, facadeysize=0.1, facadezsize=0.2, xcol=2, ycol=3, dis=0.4, vertical_spacing=0.5, levels=(levels-1), f_height=0.5, hgt=2.7, thick=0.2): facade = [] # total height of the building (total height = number of levels * height per level) total_building_height = levels * hgt + +levels * thick # width of the facade in the x-direction (same as the building width) facade_width = A * (xcol - 1) + 2 * B # Set the starting X and Y positions for the facade x_start = center_pt[0] - p_width / 2 y_start = insertion[1] z_start = f_height+ f_height # number of horizontal facade lines (vertical elements) based on the total height of the building num_vertical_lines = int(total_building_height // vertical_spacing) # number of horizontal elements (spanning the width of the facade) num_horizontal_elements = int(facade_width // dis) + 1 # loop to create horizontal facade elements for i in range(num_vertical_lines): height_offset = i * vertical_spacing + z_start # vertical offset for each horizontal line for j in range(num_horizontal_elements): x_position = j * dis + x_start # horizontal position aligned with the left edge of the building facade.append(make_box([x_position, y_start, height_offset], facadexsize, facadeysize, facadezsize)) return facade facade_list = make_hor_facade() def make_facade_lines(insertion=[0, 0, 0], depth=0.4, width=0.1, height=(levels-1)*(hgt+thick), dist=0.4): fc = [] num_facade_lines = int(p_length // dist) + 1 # offset in X direction (to position the facade relative to the columns) off = A * (xcol - 2.55) + B # loop through the number of facade lines and place them along the building length for i in range(num_facade_lines): # y position for each facade element, spacing them by 'dist' y_position = i * dist - f_size / 2 # add element to the list fc.append(make_box([off, y_position, f_height], depth, width, height)) return fc facade_2 = make_facade_lines() # Print results for debugging print(facade_2) print(f_list) print(c_list) print(p_list) print(w_list) print(facade_list) rs.EnableRedraw(True)