import rhinoscriptsyntax as rs import math # Delete all objects and start fresh rs.DeleteObjects(rs.AllObjects()) def create_scallop_shell_with_pipes(): # Shell parameters shell_width = 12 # Width of the shell shell_height = 10 # Height of the shell curvature_height = 2 # Vertical curvature of the shell rib_count = 30 # Number of radial ribs shell_thickness = 0.4 # Thickness of the shell pipe_radius = 0.2 # Radius of the pipes along each rib # Define the outer profile curve of the shell outer_profile_points = [ (0, 0, 0), (shell_width * 0.2, -shell_height * 0.2), (shell_width * 0.5, -shell_height * 0.5), (shell_width * 0.8, -shell_height * 0.4), (shell_width, 0), (shell_width * 0.8, shell_height * 0.4), (shell_width * 0.5, shell_height * 0.5), (shell_width * 0.15, shell_height * 0.15), (0, 0, 0) ] outer_profile_curve = rs.AddInterpCurve(outer_profile_points) # Adjust the curvature for the scallop shell rib_curves = [] pipes = [] for i in range(rib_count + 1): t = i / rib_count # Parameter along the profile curve rib_point = rs.EvaluateCurve(outer_profile_curve, rs.CurveParameter(outer_profile_curve, t)) rib_points = [] for j in range(20): # Create points along each rib factor = j / 19 x = rib_point[0] * factor y = rib_point[1] * factor z = curvature_height * math.sin(math.pi * factor) * (1 - factor**0.5) # Smooth transition rib_points.append((x, y, z)) rib_curve = rs.AddInterpCurve(rib_points) rib_curves.append(rib_curve) # Add a pipe along each rib curve pipe = rs.AddPipe(rib_curve, [0, 1], [pipe_radius, pipe_radius]) if pipe: pipes.append(pipe) # Run the script create_scallop_shell_with_pipes()