import rhinoscriptsyntax as rs import random as ran import random rs.DeleteObjects(rs.AllObjects()) rs.EnableRedraw(False) """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #ZEN-GARDEN GENERATOR """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #Wave: # Define points for the initial curve points = [(0, 0, 0), (100, 0, 100), (200, 0, 0), (300, 0, -100), (400, 0, 0)] # Add the initial curve curve = rs.AddCurve(points) if curve: # Define the translation vector for copying translation_vector = (400, 0, 0) # Specify the number of copies to create num_copies = 60 # Store all created curves curves = [curve] # Create the chain of curves by copying for _ in range(num_copies): new_curve = rs.CopyObject(curve, translation_vector) if new_curve: curves.append(new_curve) # Update the reference curve for the next iteration curve = new_curve # Join the curves into a single curve joined_curve1 = rs.JoinCurves(curves) if joined_curve1: # Extrude the joined curve extrusion_vector = (0, 40000, 0) # Extrude in the Y direction extrusion_surface = rs.ExtrudeCurveStraight(joined_curve1, (0, 0, 0), extrusion_vector) """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #Circle_Wave1: points = [(0, 0, 0), (100, 0, -110), (200, 0, 0), (300, 0, 110), (400, 0, 0), (500, 0, -110), (600, 0, 0), (700, 0, 110), (800, 0, 0)] curve = rs.AddCurve(points) if curve: # Define the translation vector for copying translation_vector = (800, 0, 0) # Specify the number of copies to create num_copies = 1 # Store all created curves curves = [curve] # Create the chain of curves by copying for _ in range(num_copies): new_curve = rs.CopyObject(curve, translation_vector) if new_curve: curves.append(new_curve) # Update the reference curve for the next iteration curve = new_curve # Join the curves into a single curve joined_curve2 = rs.JoinCurves(curves) if joined_curve2: # Define a new curve to add at the end new_curve_points = [(1600,0,0),(1700,0,-200)] new_curve = rs.AddCurve(new_curve_points) if new_curve: # Join the new curve with the existing joined curve final_joined_curve = rs.JoinCurves([joined_curve2, new_curve]) # Add a circle at the start point of the initial curve circle_center = points[0] # Center at the first point of the initial curve circle_radius = 500 # Define the radius of the circle circle = rs.AddCircle(circle_center, circle_radius) # Sweep the curve along the circle if final_joined_curve and circle: sweep_surface = rs.AddSweep1(circle, final_joined_curve) # Sweep the profile curve along the rail (circle) rs.MoveObject(sweep_surface, [10000,10000,125]) # Define the fixed coordinate system boundaries min_x = -1000 # minimum x boundary max_x = 9000 # maximum x boundary min_y = -5000 # minimum y boundary max_y = 29000 # maximum y boundary min_z = 0 # minimum z boundary max_z = 0 # maximum z boundary # Number of copies to create num_copies = 4 # Function to generate a random translation vector within the specified boundaries def generate_random_translation(): random_x = random.uniform(min_x, max_x) random_y = random.uniform(min_y, max_y) random_z = random.uniform(min_z, max_z) return (random_x, random_y, random_z) # Copy the object to random locations for _ in range(num_copies): translation_vector = generate_random_translation() new_object = rs.CopyObject(sweep_surface, translation_vector) # rs.DeleteObject(sweep_surface) rs.Redraw() """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #Circle_Wave2: # Define points for the circle curve points = [(0, 0, 0), (100, 0, -110), (200, 0, 0), (300, 0, 110), (400, 0, 0), (500, 0, -110), (600, 0, 0), (700, 0, 110), (800, 0, 0), (900, 0, -110), (1000, 0, 0), (1100, 0, 110), (1200, 0, 0)] curve = rs.AddCurve(points) if curve: # Define the translation vector for copying translation_vector = (1200, 0, 0) # Specify the number of copies to create num_copies = 1 # Store all created curves curves = [curve] # Create the chain of curves by copying for _ in range(num_copies): new_curve = rs.CopyObject(curve, translation_vector) if new_curve: curves.append(new_curve) curve = new_curve # Join the curves into a single curve joined_curve2 = rs.JoinCurves(curves) if joined_curve2: # Define a new curve to add at the end new_curve_points = [(2400,0,0),(2500,0,-200)] new_curve = rs.AddCurve(new_curve_points) if new_curve: # Join the new curve with the existing joined curve final_joined_curve = rs.JoinCurves([joined_curve2, new_curve]) # Add a circle at the start point of the initial curve circle_center = points[0] # Center at the first point of the initial curve circle_radius = 500 # Define the radius of the circle circle = rs.AddCircle(circle_center, circle_radius) # Sweep the curve along the circle if final_joined_curve and circle: sweep_surface2 = rs.AddSweep1(circle, final_joined_curve) # Sweep the profile curve along the rail (circle) rs.MoveObject(sweep_surface2, [20000,30000,125]) """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #Stone: # Create a profile curve (a half oval shape) profile_points = [(0, 0), (20, -10), (40, -5), (55, -20), (70, -10), (80, 10), (75, 30), (60, 50), (40, 60), (20, 55), (5, 40), (0, 0)] profile_curve = rs.AddInterpCurve(profile_points, degree=3) # Define the axis of revolution (Z-axis) axis_start = (1000, 0, 0) axis_end = (100, 10, 0) axis = rs.AddLine(axis_start, axis_end) # Create axis as a line # Revolve the profile curve if profile_curve and axis: revolved_surface = rs.AddRevSrf(profile_curve, axis) # Cleanup: Delete the temporary axis line rs.DeleteObject(axis) rs.ScaleObject(revolved_surface, (0,0,0), (40,25,60), False) rs.MoveObject(revolved_surface, [18500,29500,1500]) """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #RanCircleStone CircleStone = rs.MoveObject(sweep_surface2, [0,0,0]), rs.MoveObject(revolved_surface, [0,0,0]) # Define the fixed coordinate system boundaries min_x = 0 # minimum x boundary max_x = -15000 # maximum x boundary min_y = 5000 # minimum y boundary max_y = -29000 # maximum y boundary min_z = 0 # minimum z boundary max_z = 0 # maximum z boundary # Number of copies to create num_copies = 4 # Function to generate a random translation vector within the specified boundaries def generate_random_translation(): random_x = random.uniform(min_x, max_x) random_y = random.uniform(min_y, max_y) random_z = random.uniform(min_z, max_z) return (random_x, random_y, random_z) # Copy the object to random locations for _ in range(num_copies): translation_vector = generate_random_translation() new_object = rs.CopyObject(CircleStone, translation_vector) # rs.DeleteObject(CircleStone) rs.Redraw() """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #Border: # Add a rectangle corner_points1 = [ [-100, -1000, 0], # Point 1 (Base corner) [25000, -1000, 0], # Point 2 (Base corner) [25000, 41000, 0], # Point 3 (Base corner) [-100, 41000, 0], # Point 4 (Base corner) [-100, -1000, 4000], # Point 5 (Top corner) [25000, -1000, 4000], # Point 6 (Top corner) [25000, 41000, 4000], # Point 7 (Top corner) [-100, 41000, 4000] # Point 8 (Top corner) ] # Create the box using the corner points box1 = rs.AddBox(corner_points1) rs.MoveObject(box1, [0,0,-3800]) corner_points2 = [ [900, 100, 0], # Point 1 (Base corner) [24000, 100, 0], # Point 2 (Base corner) [24000, 40000, 0], # Point 3 (Base corner) [900, 40000, 0], # Point 4 (Base corner) [900, 100, 4000], # Point 5 (Top corner) [24000, 100, 4000], # Point 6 (Top corner) [24000, 40000, 4000], # Point 7 (Top corner) [900, 40000, 4000] # Point 8 (Top corner) ] # Create the box using the corner points box2 = rs.AddBox(corner_points2) rs.MoveObject(box2, [0,0,-3800]) rs.BooleanDifference(box1, box2) """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #Tori: #cylinder cylinder1 = rs.AddCylinder((0,0,0), 5000, 300) cylinder2 = rs.AddCylinder((4000,0,0), 5000, 300) # Define the 8 corner points of the box points5 = [ (0,0,0), (0,200,0), (6000,200,0), (6000,0,0), (0,0,400), (0,200,400), (6000,200,400), (6000,0,400) ] points6 = [ (0,0,0), (0,200,0), (6000,200,0), (6000,0,0), (0,0,400), (0,200,400), (6000,200,400), (6000,0,400) ] # Create the box box5 = rs.AddBox(points5) rs.MoveObject(box5, (-1000,-100,3500)) box6 = rs.AddBox(points6) rs.MoveObject(box6, (-1600,-100,4000)) rs.ScaleObject(box6, (0,0,0), (1.4,4,1.2), False) rs.MoveObject(box5, (0,0,-100)) rs.MoveObject(box6, (0,0,-100)) rs.MoveObject(cylinder1, (0,0,-100)) rs.MoveObject(cylinder2, (0,0,-100)) Tori = rs.MoveObject(box5, (0,0,-100)),rs.MoveObject(box6, (0,0,-100)),rs.MoveObject(cylinder1, (0,0,-100)),rs.MoveObject(cylinder2, (0,0,-100)) rs.MoveObject(Tori, (10000,0,-100)) # Define the fixed coordinate system boundaries min_x = 0 # minimum x boundary max_x = 8000 # maximum x boundary min_y = 0 # minimum y boundary max_y = 40000 # maximum y boundary min_z = 0 # minimum z boundary max_z = 0 # maximum z boundary # Number of copies to create num_copies = 10 # Function to generate a random translation vector within the specified boundaries def generate_random_translation(): random_x = random.uniform(min_x, max_x) random_y = random.uniform(min_y, max_y) random_z = random.uniform(min_z, max_z) return (random_x, random_y, random_z) # Copy the object to random locations for _ in range(num_copies): translation_vector = generate_random_translation() new_object = rs.CopyObject(Tori, translation_vector) # rs.DeleteObject(Tori) rs.Redraw() """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #WoodenPlateau: corner_points1 = [ [-3000, -4000, 0], # Point 1 (Base corner) [28000, -4000, 0], # Point 2 (Base corner) [28000, 44000, 0], # Point 3 (Base corner) [-3000, 44000, 0], # Point 4 (Base corner) [-3000, -4000, 4000], # Point 5 (Top corner) [28000, -4000, 4000], # Point 6 (Top corner) [28000, 44000, 4000], # Point 7 (Top corner) [-3000, 44000, 4000] # Point 8 (Top corner) ] # Create the box using the corner points box1 = rs.AddBox(corner_points1) rs.MoveObject(box1, [0,0,-4400]) corner_points1 = [ [-6000, -7000, 0], # Point 1 (Base corner) [31000, -7000, 0], # Point 2 (Base corner) [31000, 47000, 0], # Point 3 (Base corner) [-6000, 47000, 0], # Point 4 (Base corner) [-6000, -7000, 3400], # Point 5 (Top corner) [31000, -7000, 3400], # Point 6 (Top corner) [31000, 47000, 3400], # Point 7 (Top corner) [-6000, 47000, 3400] # Point 8 (Top corner) ] # Create the box using the corner points box1 = rs.AddBox(corner_points1) rs.MoveObject(box1, [0,0,-4400]) """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #Delete_Lines: # Get all curve objects in the document all_curves = rs.ObjectsByType(rs.filter.curve) # Delete them if all_curves: rs.DeleteObjects(all_curves) """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #The End!