organic-wall-made-in-Rhino-3D

Rhino’s Python scripting capabilities allow you to generate complex organic shapes and forms. In this tutorial, we’ll walk through several methods to create an organic, wavy wall surface using Python in Rhino 7.

Method 1: AddSineWave

The AddSineWave command in rhinoscriptsyntax lets you quickly generate a sine wave shaped surface.

  1. Open Rhino and start a new model.
  2. Open the PythonScript command box (right click in viewport and click PythonScript).
  3. Enter the following script:
import rhinoscriptsyntax as rs

amplitude = 5
frequency = 3 
rs.AddSineWave(amplitude, frequency)
  1. Press enter to run. This will create a sine wave surface in the viewport with the specified amplitude and frequency.
  2. You can experiment with different values to get more exaggerated waves.

Method 2: Sampling and Offsetting Points

This method samples points on an existing surface, offsets them randomly, and generates a new wavy surface.

  1. Draw a rectangular surface in Rhino.
  2. Open the PythonScript command box.
  3. Enter the following script:
import rhinoscriptsyntax as rs
import random

surface = rs.GetObject("Select surface", rs.filter.surface)
pointcloud = rs.SampleSurface(surface, 100, 100)

for point in pointcloud:
    x = point[0] + random.uniform(-5, 5)
    y = point[1] + random.uniform(-5, 5) 
    z = point[2] + random.uniform(-5, 5)
    
    point.X = x
    point.Y = y
    point.Z = z

rs.AddPoints(pointcloud)
  1. When prompted, select the rectangular surface. This will sample points, offset them randomly, and display the new wavy point cloud.
  2. To convert to a surface, add this line at the end:
new_surface = rs.AddPlanarSrf(pointcloud)

Method 3: Lofting Random CV Points

We can create a wavy surface by defining control points and lofting between them.

  1. Open the PythonScript command box.
  2. Enter the following script:
import rhinoscriptsyntax as rs
import random

points = []

for i in range(10):
    for j in range(10):
        x = i*10
        y = j*10
        z = random.uniform(0,10)
        
        points.append([x,y,z])
        
surface = rs.AddNurbsSurface(points, 3, 3)
  1. This will generate a grid of random CV points and fit a smoothing surface through them.

Method 4: Rotating Mesh Vertices

Applying random rotations to a mesh creates irregularities.

  1. Draw a rectangle and convert it into a mesh.
  2. Open the PythonScript command box.
  3. Enter the following script:
import rhinoscriptsyntax as rs
import random

mesh = rs.GetObject("Select mesh", rs.filter.mesh)

for i in range(mesh.Vertices.Count):
    a = random.uniform(-180, 180)
    b = random.uniform(-180, 180)
    c = random.uniform(-180, 180)
    
    rs.RotateObject(mesh.Vertices[i], a, b, c)
    
surface = rs.AddPlanarSrf(mesh)
  1. Select the mesh when prompted. This will rotate the vertices randomly and generate a wavy surface.

Summary

These examples demonstrate some techniques for creating organic, uneven surfaces using Python scripting in Rhino. By using tools like randomization, noise, and sine waves, you can generate unique geometric shapes and forms algorithmically. The rhinoscriptsyntax library provides several useful commands for prototyping and experimentation.