import rhinoscriptsyntax as rs import random as ran import fantastic_stairs_lib as fs def create_staircase( height, # Total height of the staircase th_num, # Stair height num_steps, # Number of steps in the staircase platforms, # Number of platforms platform_radius, # Radius of each platform platform_thickness, # Thickness of the platforms hole_radius, # Radius of the central hole in each platform num_rod, # Number of rods in the upper part handrail_start_height, # Starting height of the handrail handrail_end_height, # Ending height of the handrail handrail_width, # Width of the handrail spiral_spacing, # Spacing between spirals in the handrail middle_radius, # Radius of the middle part column_radius, # Radius of the vertical columns base_radius, # Radius of the base cylinder rod_radius, # Radius of the rods in the upper part platform_heights, # List of platform heights (user-defined) middle_part_radius, # Neuer Parameter für die mittlere Struktur upper_part_radius # Neuer Parameter für die obere Struktur ): rs.DeleteObjects(rs.AllObjects()) # Base Cylinder crl = rs.AddCircle([0, 0, 0], base_radius) rs.ExtrudeCurveStraight(crl, [0, 0, 0], [0, 0, height]) srf = rs.FirstObject(select=False) rs.CapPlanarHoles(srf) # Stair crv = rs.AddSpiral([0, 0, 0], [0, 0, 1], 0, spiral_spacing, 1) fs.make_curved_stair(crv, th=th_num, steps=num_steps) # Platforms for platform_height in sorted(platform_heights): oc = rs.AddCircle([2, 0, platform_height], platform_radius) ic = rs.AddCircle([0, 0, platform_height], hole_radius) oc_pl = rs.ExtrudeCurveStraight(oc, [0, 0, platform_height], [0, 0, platform_height + platform_thickness]) ic_pl = rs.ExtrudeCurveStraight(ic, [0, 0, platform_height], [0, 0, platform_height + platform_thickness]) rs.CapPlanarHoles(oc_pl) rs.CapPlanarHoles(ic_pl) rs.BooleanDifference(oc_pl, ic_pl, delete_input=True) # Handrail crv1 = rs.AddSpiral([0, 0, handrail_start_height], [0, 0, handrail_end_height], 3.6055, handrail_width, 1.62) crv2 = rs.CopyObject(crv1, [0, 0, 1.2]) if crv1 and crv2: rs.AddLoftSrf([crv1, crv2]) # Double Handrail crv3 = rs.AddSpiral([0, 0, 0], [0, 0, 1.2], 3.6, 0.75, 1.62) crv4 = rs.CopyObject(crv3, [0, 0, 2.4]) if crv3 and crv4: rs.AddLoftSrf([crv3, crv4]) # Other Handrail oc2 = rs.CopyObject(oc,[0,0,1.2]) if oc and oc2: rs.AddLoftSrf([oc, oc2]) ic3 = rs.AddArc([0,0,platform_heights[0]],1.62, 320) ic4 = rs.CopyObject(ic3,[0,0,1.2]) if ic3 and ic4: ic5 = rs.AddLoftSrf([ic3, ic4]) rs.RotateObject(ic5, [0,0,platform_heights[0]], rotation_angle=-73.045, axis=None, copy=False) rs.DeleteObject(ic4) # Upper Part u_circle_center = [0, 0, height - 4] uc = rs.AddCircle(u_circle_center, upper_part_radius) # Use upper_part_radius here pts = rs.DivideCurve(uc, num_rod) for i in range(len(pts)): start_point = pts[i] end_point = [start_point[0], start_point[1], start_point[2] + 0.5] rod_line = rs.AddLine(start_point, end_point) rs.AddPipe(rod_line, 0, rod_radius) top_circle = rs.AddCircle([u_circle_center[0], u_circle_center[1], u_circle_center[2] + 0.5], upper_part_radius) # Use upper_part_radius here bottom_circle = rs.AddCircle(u_circle_center, upper_part_radius) # Use upper_part_radius here h1_pipe = rs.AddPipe(top_circle, 0, rod_radius) h2_pipe = rs.AddPipe(bottom_circle, 0, rod_radius) # Pipe to the center num_rods = 6 center_point = [0, 0, height - 4] points_on_circle = rs.DivideCurve(uc, num_rods, create_points=True, return_points=True) for point in points_on_circle: rod_line = rs.AddLine(point, center_point) rs.AddPipe(rod_line, [0, 1], [0.08, 0.1], cap=2) # Middle Part m_circle_center = [-1, 0, height - 8] mc = rs.AddCircle(m_circle_center, middle_part_radius) # Use middle_part_radius here rs.ExtrudeCurveStraight(mc, m_circle_center, [-1, 0, height - 7.5]) pts1 = rs.DivideCurve(mc, 8, create_points=True, return_points=True) # Pipe the middle part for point in pts1: rod_line = rs.AddLine([0, 0, height - 8], [point[0], point[1], height - 8]) rs.AddPipe(rod_line, [0, 1], [0.15, 0.1], cap=2) # Columns for p in pts1: crv = rs.AddCurve([p, (p[0], p[1], 0)], 1) rs.AddPipe(crv, 0, column_radius) # Example usage create_staircase( height=33, th_num=0.176470588, num_steps=119, platforms=1, platform_radius=5, platform_thickness=0.5, hole_radius=1.6, num_rod=40, handrail_start_height=0, handrail_end_height=21, handrail_width=5.685, spiral_spacing=8, middle_radius=3, column_radius=0.005, base_radius=0.5, rod_radius=0.05, middle_part_radius=4, upper_part_radius=3.5, platform_heights=[20.5] # try [0,0,33] or [3,5,8] or [10,12,5] )