# -*- coding: utf-8 -*- import rhinoscriptsyntax as rs import math rs.DeleteObjects(rs.AllObjects()) def create_tatlin_tower(base_radius, top_radius, height, levels, twist_angle, curvature_factor, beam_thickness, support_count): """ Creates a Tatlin Tower in Rhino 8 with extruded steel forms, including supports connected to spirals. :param base_radius: Radius of the tower's base :param top_radius: Radius of the tower's top :param height: Total height of the tower :param levels: Number of levels in the tower :param twist_angle: Total twist angle over the height (in degrees) :param curvature_factor: Controls the horizontal displacement for curvature :param beam_thickness: Thickness of the extruded steel beams :param support_count: Number of vertical support beams """ level_height = height / levels twist_per_level = math.radians(twist_angle / levels) spiral1_curves = [] spiral2_curves = [] for i in range(levels + 1): factor = i / levels current_radius = base_radius * (1 - factor) + top_radius * factor # Linear tapering angle1 = i * twist_per_level angle2 = angle1 + math.pi # 180° offset z = i * level_height curve_shift = curvature_factor * (factor ** 2) # Smooth curvature effect point1 = [ current_radius * math.cos(angle1) + curve_shift, current_radius * math.sin(angle1), z ] spiral1_curves.append(point1) point2 = [ current_radius * math.cos(angle2) + curve_shift, current_radius * math.sin(angle2), z ] spiral2_curves.append(point2) spiral1 = rs.AddInterpCurve(spiral1_curves, degree=3) spiral2 = rs.AddInterpCurve(spiral2_curves, degree=3) if spiral1 and spiral2: rs.ExtrudeCurveStraight(spiral1, [0, 0, 0], [0, 0, beam_thickness]) rs.ExtrudeCurveStraight(spiral2, [0, 0, 0], [0, 0, beam_thickness]) for i in range(len(spiral1_curves) - 1): line = rs.AddLine(spiral1_curves[i], spiral2_curves[i]) if line: rs.ExtrudeCurveStraight(line, [0, 0, 0], [0, 0, beam_thickness]) # Connect supports to spirals for i in range(support_count): angle = i * (2 * math.pi / support_count) for j in range(levels + 1): factor = j / levels current_radius = base_radius * (1 - factor) + top_radius * factor z = j * level_height support_point = [ current_radius * math.cos(angle) + curvature_factor * (factor ** 2), current_radius * math.sin(angle), z ] if j > 0: support_line = rs.AddLine(prev_support_point, support_point) if support_line: rs.ExtrudeCurveStraight(support_line, [0, 0, 0], [0, 0, beam_thickness]) prev_support_point = support_point print("Tatlin Tower with connected supports created successfully!") # Tower parameters base_radius = 15 top_radius = 5 height = 50 levels = 30 twist_angle = 1080 curvature_factor = 10 beam_thickness = 0.5 support_count = 16 # Run the function create_tatlin_tower(base_radius, top_radius, height, levels, twist_angle, curvature_factor, beam_thickness, support_count)