Complete Offline Learning Package
MIT License — Open Source
Created by Dinesh Kumar Alagusundaram

Python for
Rhino & Grasshopper

Everything you need to master Python scripting in Rhino — drawn from the official Primer, RhinoScript101, and the complete live API. Reads offline, no internet needed.

▶  Start Learning ⚙  API Reference ⚡  Cheatsheet
Content sourced from
Python Primer for Rhino — Tibbits / van der Harten / Baer (2011, Rev 3)
RhinoScript Primer 101 — D. Rutten / Robert McNeel & Associates
RhinoScriptSyntax Live API — developer.rhino3d.com (offline snapshot)
Rhino.Geometry (RhinoCommon) — .NET geometry SDK
Curriculum
12 Chapters, Zero to Expert

Each chapter builds on the last — from Rhino macros to full NURBS geometry scripting. Real code from the official primers throughout.

CH 01
🐍
What is Scripting?
Macros vs Scripts vs Programs. The EditPythonScript editor. Running your first line of code.
macroseditorRunPythonScript
CH 02
📦
Python Essentials
Variables, all data types, naming conventions, indentation, case sensitivity, flow control.
intfloatstrboolNone
CH 03
( )
Brackets Decoded
All three bracket types: parentheses for calls, square for lists/indexing, curly for dicts.
( )[ ]{ }slicing
CH 04
Operators & Functions
All operator types, precedence, def / return, default args, variable scope, mutability.
+−×÷defreturnscope
CH 05
Conditionals
if / elif / else chains. Boolean logic with Venn diagrams. Rhino object classification examples.
ifelifelseandornot
CH 06
Loops
while and for loops. Sine wave example. Sphere distribution with nested loops. break / continue.
forwhilerange()breakfrange
CH 07
📋
Lists, Tuples, Dicts
All container types with methods, list comprehensions, nested lists, mutability deep dive.
listtupledictmutable[ : ]
CH 08
🏛
Classes
Object-Oriented Programming: __init__, self, inheritance, polymorphism, isinstance().
class__init__selfinherit
CH 09
📐
Geometry Deep Dive
Points, vectors, lines, planes, circles (Rusin algorithm), NURBS, surfaces, meshes, parameter spaces.
Point3dNURBSSurfaceMeshR1/R2/R3
CH 10
🔗
Imports & Modules
All four import forms. rs vs rg, ghpythonlib, System.Drawing. Complete GHPython template.
rsrgghcompmathrandom
CH 11
🐛
Debugging
The Rhino debugger: breakpoints, step controls, variable pane. Common errors and fixes.
breakpointsteptry/excepterrors
CH 12
Grasshopper Python
GHPython setup, inputs/outputs, DataTree, rs vs rg in GH. Full point grid and facade examples.
GHPythonDataTreeaccesscolor
CH 13
Strings Deep Dive
All string methods, slicing, f-strings with format specifiers, .format(), raw strings, escape chars.
f-string.split().join()slicezfill
CH 14
🛡
Error Handling
try/except/else/finally. All exception types. Raising custom exceptions. Defensive Rhino patterns.
tryexceptraiseValueErrorfinally
CH 15
💾
File I/O
Read/write txt files, with statement, JSON save/load, os.path, save script settings pattern from Primer.
open()withjsonos.pathreadlines
CH 16
λ
Advanced Python
lambda, *args/**kwargs, generators with yield, advanced list/dict/set comprehensions, map/filter.
lambda*argsyieldgeneratormap
CH 17
RhinoCommon (rg.)
Point3d, Vector3d, Plane, Line, Transform, NurbsCurve, Brep. rs. vs rg. comparison. GH geometry.
Point3dVector3dNurbsCurveBreprg.
CH 18
🏗
Parametric Patterns
Attractor fields, mesh from f(x,y), parametric tower, GH DataTrees, the 5 parametric principles.
attractormeshtowerlerpnormalize
API Reference — Offline
RhinoScriptSyntax — 26 Categories

Complete offline copy of the official Rhino Python API, organized by function category. Click any card to jump to its section.

module
Application
~35 methods
module
Block
~15 methods
module
Curve
~80 methods
module
Dimension
~12 methods
module
Document
~20 methods
module
Geometry
~15 methods
module
Grips
~8 methods
module
Group
~8 methods
module
Hatch
~6 methods
module
Layer
~25 methods
module
Light
~12 methods
module
Line
~8 methods
module
Linetype
~8 methods
module
Material
~15 methods
module
Mesh
~40 methods
module
Object
~45 methods
module
Plane
~12 methods
module
Point/Vector
~30 methods
module
Selection
~20 methods
module
Surface
~55 methods
module
Toolbar
~8 methods
module
Transformation
~20 methods
module
User Data
~10 methods
module
User Interface
~25 methods
module
Utility
~15 methods
module
View
~30 methods