#WS24/25 DM2 HUE11 Larisa Harbas #Inspo building "The Infinity Tower" DNA Barcelona Architects import rhinoscriptsyntax as rs import math allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) # Parameters A = 6 # Base size of the floor B = A / 2 # Increased width of the floor thick = 0.5 # Thickness of each floor hgt = 4 # Height of each floor xcol = 5 # Number of columns ycol = 4 # Number of rows levels = 30 # Number of levels (same as my inspo building) f_height = 0.5 # Floor height f_size = 0.8 # Floor size rotation_per_level = 10 # Normal rotation per level #Derived values center_pt = [A * (xcol - 1) / 2, A * (ycol - 1) / 2, f_height] mid_level = levels // 2 # Middle of the building total_rotation = rotation_per_level * (levels - 1) # Total rotation correction_angle = -total_rotation % 360 # Ensuring top aligns with bottom rs.EnableRedraw(False) # Scaling function def scale_factor(level, total_levels): mid = total_levels / 2 # Middle of the building(wider) if level <= mid: scale = 0.5 + 1.0 * (level / mid) # Slightly narrower at the bottom else: scale = 0.5 + 1.0 * ((total_levels - level) / mid) # Slightly narrower at the top return scale # Rotation function to ensure top matches bottom direction def rotation_function(level, total_levels): if level <= mid_level: return level * rotation_per_level # Normal rotation before the middle else: correction_factor = (level - mid_level) / (total_levels - mid_level) # Smooth transition of the rotation and floors return level * rotation_per_level + correction_angle * correction_factor # Function to create the glass core in the middle def make_glass(insertion, level): scale = scale_factor(level, levels) curve = rs.AddEllipse(rs.WorldXYPlane(), 10 * scale, 6 * scale) path = rs.AddLine([3, 0, 0], [3, 0, hgt]) wall = rs.ExtrudeCurve(curve, path) rs.CapPlanarHoles(wall) rs.MoveObject(wall, (10, 7.5, 0)) rs.DeleteObjects([curve, path]) return wall # Creating the glass core for each floor b_list = [] for i in range(levels): center_pt[2] = i * hgt b_list.append(make_glass(center_pt, i)) rs.MoveObject(b_list[-1], [0, 0, hgt * i]) rs.RotateObject(b_list[-1], center_pt, rotation_function(i, levels), (0, 0, 1)) # Function to create the floor with dynamic width def make_floor(insertion, level): scale = scale_factor(level, levels) curve = rs.AddEllipse(rs.WorldXYPlane(), 16 * scale, 12 * scale) path = rs.AddLine([3, 0, 0], [3, 0, 0.5]) wall = rs.ExtrudeCurve(curve, path) rs.CapPlanarHoles(wall) rs.MoveObject(wall, (10, 7.5, 0)) rs.DeleteObjects([curve, path]) return wall # Creating the floors plate_list = [] for i in range(1, levels): center_pt[2] = i * hgt plate_list.append(make_floor(center_pt, i)) rs.MoveObject(plate_list[-1], [0, 0, hgt * i]) rs.RotateObject(plate_list[-1], center_pt, rotation_function(i, levels), (0, 0, 1)) # Function to create the outer fence with dynamic width def make_fence(insertion, level): scale = scale_factor(level, levels) curve = rs.AddEllipse(rs.WorldXYPlane(), 14 * scale, 10 * scale) path = rs.AddLine([3, 0, 0], [3, 0, 1]) fence_wall = rs.ExtrudeCurve(curve, path) rs.MoveObject(fence_wall, (10, 7.5, 0.5)) rs.DeleteObjects([curve, path]) return fence_wall # Creating the fence fence_list = [] for i in range(1, levels): center_pt[2] = i * hgt fence_list.append(make_fence(center_pt, i)) rs.MoveObject(fence_list[-1], [0, 0, hgt * i]) rs.RotateObject(fence_list[-1], center_pt, rotation_function(i, levels), (0, 0, 1)) rs.EnableRedraw(True)