import rhinoscriptsyntax as rs import math # delete everything and start from scratch allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) #s = 137.508 s = 137 point0 = (0,0,0) # Starting point of the spiral (axis) pitch = 0.5 # Distance between turns height = 2000 # Total height of the spiral radius_scale = 0.4 # Scaling factor for circle radii z_scale = 0.1 # Scaling factor for height per circle group_name = "fractal_circles" block_name = "bl_circle" b_scale = [0.02,0.02,0] ### make fibonacci spiral ### # Fibonacci spiral with conical arrangement circle_ids = [] for n in range(0, 500): # Number of circles in the Fibonacci spiral t = math.sqrt(n) # Radius of the Fibonacci spiral (distance from the center) g = n * s # Angle (in degrees) # Calculate the position in the Fibonacci spiral xy_point = rs.Polar([0, 0, 0], g, t) # Z-coordinate based on the position in the spiral z = n * z_scale # Linear increase in Z-height xyz_point = (-xy_point[0], -xy_point[1], -z) # Radius based on the Z-coordinate to create a conical shape radius = radius_scale * (1 - z / height) # Radius tapers off as it goes up if radius < 0.01: # Minimum size for the radius radius = 0.01 # Add a circle #rs.AddCone(xyz_point, -height_c, radius, cap=True) circle_id = rs.AddCircle(xyz_point, radius) circle_ids.append(circle_id) block = rs.AddBlock(circle_ids, [0,0,0], block_name, delete_input=False) origin = xyz_point # Group circles if circle_ids: rs.AddGroup(group_name) rs.AddObjectsToGroup(circle_ids, group_name) rs.InsertBlock(block_name, origin, b_scale, 0, [0,0,0]) # Copy and scale fractal_circles fractal = rs.ScaleObject(circle_ids, origin, [0.02,0.02,0], True)