import rhinoscriptsyntax as rs # Delete all objects rs.DeleteObjects(rs.AllObjects()) # parameters radius = 23.5 # Radius of the largest dome cylinder_height = 10 # Height of the cylinder under the largest dome ################################################## Function to create domes with cylinders def make_dome(base_point=(0, 0, 0), radius=radius, create_cylinder=False, cylinder_height=10): # Create the dome arc = rs.AddArc3Pt((base_point[0] - radius, base_point[1], base_point[2]), (base_point[0] + radius, base_point[1], base_point[2]), (base_point[0], base_point[1] + radius, base_point[2])) axis = rs.AddLine(base_point, (base_point[0] + 1, base_point[1], base_point[2])) dome = rs.AddRevSrf(arc, axis, 0, 180) # Create a cylinder under the dome cylinder = None if create_cylinder: cylinder_base = (base_point[0], base_point[1], base_point[2] - cylinder_height) cylinder = rs.AddCylinder(cylinder_base, cylinder_height, radius) return dome, cylinder ################################################## Create the main dome with a cylinder main_dome, main_cylinder = make_dome(base_point=(0, radius, 0), radius=radius, create_cylinder=True, cylinder_height=cylinder_height) ################################################## Create medium-sized domes z_medium = -5 # middle sized domes are in the z-axis for -5 under the biggest dome for i in range(2): cylinder_height_medium = cylinder_height + z_medium dome1, cylinder1 = make_dome((0, i * radius * 2, z_medium), radius / 2, create_cylinder=True, cylinder_height=cylinder_height_medium) dome2, cylinder2 = make_dome((0, i * radius * 2, z_medium), radius / 2, create_cylinder=True, cylinder_height=cylinder_height_medium) # Rotate the second dome and its cylinder rs.RotateObject(dome2, [0, radius, z_medium], 90) if cylinder2: rs.RotateObject(cylinder2, [0, radius, z_medium], 90) ################################################## Create small domes z_small = -7 # small domes are in the z-axis for -7 under the middle domes for i in range(2): cylinder_height_small = cylinder_height + z_small for angle in [0, 45, 90, 135]: small_dome, small_cylinder = make_dome((0, i * radius * 3, z_small), radius / 4, create_cylinder=True, cylinder_height=cylinder_height_small) rs.MoveObject(small_dome, [0, -(radius / 2), 0]) if small_cylinder: rs.MoveObject(small_cylinder, [0, -(radius / 2), 0]) rs.RotateObject(small_dome, [0, radius, z_small], angle) if small_cylinder: rs.RotateObject(small_cylinder, [0, radius, z_small], angle) ################################################## Create the base box box_length = radius * 2 box_width = radius * 3 # Define the corner points for the base of the box pt1 = [box_length, box_width, -cylinder_height] pt2 = [box_length, -radius, -cylinder_height] pt3 = [-box_length, -radius, -cylinder_height] pt4 = [-box_length, box_width, -cylinder_height] # Create a box from the base rectangle and extrude it to -60 in Z base_box = rs.AddBox([pt1, pt2, pt3, pt4, [pt1[0], pt1[1], -60], [pt2[0], pt2[1], -60], [pt3[0], pt3[1], -60], [pt4[0], pt4[1], -60]]) # Create a scaled inner box and subtract it from the main box for creating a room scaled_box = rs.CopyObject(base_box) rs.ScaleObject(scaled_box, [0, 0, 0], [0.9, 0.9, 0.9]) rs.MoveObject(scaled_box, [0, 0, -8]) base_box = rs.BooleanDifference(base_box, scaled_box, delete_input=True) minaret_height = radius * 4 minaret_radius = radius / 4 cone_height = radius ################################################## Function to create minarets def make_minaret(base_point, minaret_height, minaret_radius, cone_height): adjusted_base_point = [base_point[0], base_point[1], -60] # Create the minaret cylinder minaret = rs.AddCylinder(adjusted_base_point, minaret_height, minaret_radius) # Position the cone on top of the minaret cone_position = [adjusted_base_point[0], adjusted_base_point[1], adjusted_base_point[2] + minaret_height + cone_height] cone = rs.AddCone(cone_position, cone_height, minaret_radius) # cone points upwards rs.RotateObject(cone, cone_position, 180, [1, 0, 0]) return minaret, cone ################################################## Create minarets at the corners corner_points = [pt1, pt2, pt3, pt4] for corner in corner_points: make_minaret(corner, minaret_height, minaret_radius, cone_height) ################################################## Add secondary cones to the minaret cones secondary_cone_height = 15 secondary_cone_radius = minaret_radius / 10 # positions for the secondary cones above the minarets secondary_cone_positions = [ [corner[0], corner[1], -60 + minaret_height + cone_height + secondary_cone_height - 5] for corner in corner_points ] # Create and place the secondary cones for position in secondary_cone_positions: secondary_cone = rs.AddCone(position, secondary_cone_height, secondary_cone_radius) rs.RotateObject(secondary_cone, position, 180, [1, 0, 0]) ################################################## Add a cone on top of the main dome cone_center = [0, radius, 2 * radius] cone_on_top = rs.AddCone(cone_center, cone_height, minaret_radius / 10) rs.RotateObject(cone_on_top, cone_center, 180, [1, 0, 0]) ################################################## Create a door small_box_width = radius # Width of the door small_box_height = (cylinder_height + 60) / 2 # Height of the door small_box_length = radius # Depth of the door base_x = 0 base_y = -radius base_z = -60 # Define the corner points of the door small_pt1 = [base_x - small_box_width / 2, base_y - small_box_length / 2, base_z] small_pt2 = [base_x + small_box_width / 2, base_y - small_box_length / 2, base_z] small_pt3 = [base_x + small_box_width / 2, base_y + small_box_length / 2, base_z] small_pt4 = [base_x - small_box_width / 2, base_y + small_box_length / 2, base_z] # Create the door and subtract it from the main box small_box = rs.AddBox([small_pt1, small_pt2, small_pt3, small_pt4, [small_pt1[0], small_pt1[1], base_z + small_box_height], [small_pt2[0], small_pt2[1], base_z + small_box_height], [small_pt3[0], small_pt3[1], base_z + small_box_height], [small_pt4[0], small_pt4[1], base_z + small_box_height]]) base_box = rs.BooleanDifference(base_box, small_box, delete_input=True) ################################################## Clean up polylines polylines = rs.ObjectsByType(4, select=False) if polylines: rs.DeleteObjects(polylines)