# first try of the inspo building import rhinoscriptsyntax as rs import math def create_twisted_building(base_radius, middle_radius, top_radius, height, twists, floors, floor_height): """ Creates a twisted building with balconies, slimmer top and bottom, and a thicker middle section. Parameters: base_radius (float): Radius of the base of the building. middle_radius (float): Radius of the middle (widest point) of the building. top_radius (float): Radius of the top of the building. height (float): Total height of the building. twists (int): Number of full twists for the facade. floors (int): Number of floors in the building. floor_height (float): Height of each floor. """ # Arrays to store balcony edges and the facade control curves balcony_edges = [] control_curves = [] for i in range(floors): z = i * floor_height # Current floor height t = i / (floors - 1) # Interpolation factor (0 at bottom, 1 at top) # Interpolate the radius for the hourglass shape if t <= 0.5: radius = base_radius + (middle_radius - base_radius) * (t / 0.5) # Bottom to middle else: radius = middle_radius + (top_radius - middle_radius) * ((t - 0.5) / 0.5) # Middle to top # Calculate the angle of twist angle = twists * 360 * t # Define the center and create the circular balcony edge center = (0, 0, z) circle = rs.AddCircle(center, radius) rs.RotateObject(circle, center, angle, axis=(0, 0, 1)) # Twist the circle balcony_edges.append(circle) # Add a planar surface for the balcony balcony = rs.AddPlanarSrf(circle)[0] rs.MoveObject(balcony, (0, 0, 0.1)) # Slightly offset the balcony surface # Add railing for the balcony rs.AddPipe(circle, 0.05, 0.05) # Uniform railing # Store the circle as a control curve for the facade control_curves.append(circle) # Create the facade by lofting the control curves facade = rs.AddLoftSrf(control_curves)[0] rs.CapPlanarHoles(facade) # Cap holes to close the surface # Parameters for the building base_radius = 4 # Smaller radius for the base middle_radius = 10 # Thickest part in the middle top_radius = 4 # Smaller radius for the top height = 60 # Total height of the building twists = 3 # Number of twists floors = 20 # Number of floors floor_height = height / floors # Height of each floor # Call the function to create the building create_twisted_building(base_radius, middle_radius, top_radius, height, twists, floors, floor_height)