Learn RHINO-GRASSHOPPER-SCRIPTING with Real Code Examples
Updated Nov 27, 2025
Code Sample Descriptions
1
Create a Point in Rhino
import Rhino
import rhinoscriptsyntax as rs
pt = rs.AddPoint(10, 20, 30)
Creates a point at specified coordinates in Rhino via Grasshopper scripting.
2
Create Multiple Points in Loop
points = []
for i in range(5):
points.append(rs.AddPoint(i*10, 0, 0))
Generates multiple points along the X-axis.
3
Draw a Line Between Two Points
pt1 = rs.AddPoint(0,0,0)
pt2 = rs.AddPoint(10,10,0)
line = rs.AddLine(pt1, pt2)
Creates a line connecting two points.
4
Draw a Circle
center = rs.AddPoint(0,0,0)
circle = rs.AddCircle(center, 5)
Creates a circle with a given center and radius.
5
Draw a Rectangle
corner1 = rs.AddPoint(0,0,0)
corner2 = rs.AddPoint(10,5,0)
rect = rs.AddRectangle(rs.WorldXYPlane(), 10, 5)
Draws a rectangle using corner points.
6
Move an Object
obj = rs.AddSphere(rs.AddPoint(0,0,0), 5)
vec = rs.VectorCreate([10,0,0],[0,0,0])
rs.MoveObject(obj, vec)
Translates an object along a vector.
7
Rotate an Object
obj = rs.AddBox([[0,0,0],[10,0,0],[10,5,0],[0,5,0],[0,0,10],[10,0,10],[10,5,10],[0,5,10]])
center = rs.AddPoint(0,0,0)
rs.RotateObject(obj, center, 45)
Rotates an object around a point by a given angle.
8
Scale an Object
obj = rs.AddSphere(rs.AddPoint(0,0,0), 5)
base = rs.AddPoint(0,0,0)
rs.ScaleObject(obj, base, [2,2,2])
Scales an object relative to a base point.
9
Create a Loft Between Curves
curve1 = rs.AddCircle(rs.AddPoint(0,0,0),5)
curve2 = rs.AddCircle(rs.AddPoint(0,0,10),3)
loft = rs.AddLoftSrf([curve1, curve2])[0]
Creates a loft surface between multiple curves.