Ten Minutes in Rhino 8's ScriptEditor: Your First Python Point, Line and Circle
Open Rhino 8's ScriptEditor, import rhinoscriptsyntax and draw a point, a line and a circle in Python — eight steps from McNeel's own developer guides.
Rhino 8 comes with its own code editor. Type ScriptEditor at the command prompt and press Enter. A window opens that Robert McNeel & Associates built into the program you already licence, and it speaks Python 3 (CPython), C# and IronPython. Ten minutes later, a click you repeat every week can become a saved instruction: a point at (1.0, 2.0, 3.0), a line between two coordinates and a circle with a radius of 5.0 units. In a metre template that radius is 5 m, and in a millimetre template it is 5 mm. That is today’s lesson, and it is built only on McNeel’s own developer guides.
Why write when you can click
A click is gone once you make it. A line of code stays. If you draw a reference circle by hand, you have to draw it again next week. If you write it, you can read it, change one number and run it again. Grasshopper is the visual way in, and Python is the room behind it. The Rhino.Python guide on McNeel’s developer site gives the purpose in plain words: automate repetitive tasks, and reach Grasshopper through GhPython components when you need the canvas. Your mouse has done enough unpaid overtime.
A note on the sources. The pages behind this tutorial are evergreen reference guides, not this week’s news. They show no publication dates, and they don’t need any. Credit also goes to the people who don’t usually get named. RhinoPython was developed at McNeel by Steve Baer, as PAZ’s Python concept panel records. Around 2011, Giulio Piacentino’s GhPython component put the language on the Grasshopper canvas. The language itself goes back to Guido van Rossum at CWI in Amsterdam, with a first public release on 20 February 1991. McNeel’s documentation writers turned that lineage into pages a beginner can follow step by step. Every step below comes from them. Any mistake is ours.
The Tool: the Rhino 8 Script Editor, together with rhinoscriptsyntax, McNeel’s Python module of readable, one-call geometry commands. You don’t clone a repo or run pip, and there’s nothing extra to download. It is worth an afternoon because it is the shortest honest route from “I draw” to “I describe what gets drawn”. That habit sits underneath every parametric workflow an architecture or engineering office will build later.
Setup:
# 1 · At the Rhino 8 command prompt, type this and press Enter:
ScriptEditor
# 2 · Wait until the first-run language setup finishes
# 3 · Dashboard → New → Python 3, delete the default comments
# 4 · Paste these two lines and press F5:
import Rhino
print(Rhino.RhinoApp.Version)
# The version number appears in the Terminal trayFirst steps:
- Open the editor and let it finish setting up. According to McNeel’s Script Editor page, the Python 3 setup is “the most important and normally the longest task”, and some features stay disabled until it is done. Get a coffee and let it finish.
- Make a new Python 3 script, run the version check, and confirm you get output in the Terminal tray.
- Follow the eight steps below to go from printing text to drawing geometry in the Rhino viewport.
Tutorial steps
- Open. Type
ScriptEditor, press Enter, and wait for the first-run setup to finish. - New. On the Dashboard, click New, choose Python 3 and remove the default comments.
- Prove it runs. Run
print(Rhino.RhinoApp.Version)with the green Run button or F5, then read the result in the Terminal tray. This sample comes straight from McNeel’s Script Editor page. - Import. Add
import rhinoscriptsyntax as rs. The RhinoScriptSyntax introduction explains that theas rspart renames the module, so every later call is short. - A point in memory. Write
pnt = rs.CreatePoint(1.0, 2.0, 3.0), thenprint(pnt.X). McNeel’s points page shows you can read the value aspnt[0]orpnt.X, and edit it withpnt.Y = 45.0. If you pass only two arguments, Z is 0. - A point and a line in the model.
rs.AddPoint(pnt)adds the point to the Rhino document and returns a GUID.rs.AddLine((45,56,32),(56,47,89))draws a line between two coordinate tuples. Press F5 and look at the viewport. - A circle. The introduction’s sample is
centerpoint = [1, 2, 4]followed byrs.AddCircle(centerpoint, 5.0). Run it, change 5.0 to 8.0 and run it again. That one-number change is the whole idea of parametric design. - Look inside, then save. Click the left margin next to a line number to set a breakpoint. Run the script, step through it with Step Over, Step In and Continue, and watch the values in the Variables tray. Then click Save and name the file
first_circle.py.
←TODAY: Rhino 8 ships a Script Editor that runs Python 3, C# and IronPython without any extra install.
→3012: The office archive that still opens is the one written in plain text, readable without the software that made it.
Fulcrum: A .py file is a drawing instruction a stranger can read decades from now, and a click leaves nothing behind.
This also bears on how long your files will last. Buildings outlive the software their files were made in. A .py file is plain text, so a 25-year-old with a text editor can open it long after your current tool stack has been replaced. When you choose where office knowledge lives, keep that in mind.
There is a trade-off. A script only repeats what you put into it. Hard-coded coordinates don’t move when the design moves, so the next skill to learn is reading input from the model instead of typing it in. McNeel’s downloadable Rhino.Python 101 Primer PDF covers that path. PAZ’s Python concept panel shows where the same habits lead: one screen of Python 3 that checks a welded I-section 300 mm deep and 150 mm wide, under 15 kN/m over a 6 m span, against an L/300 deflection limit. It uses only functions, lists and loops, the same tools you used today.
Atelier: A 12-person studio in Zürich doesn’t need a scripting department. It needs one person who has run one script and can show the others. The risk this week isn’t complexity. It’s that scripts live on individual laptops and leave the office when people do. Monday move: create a shared /scripts folder in the office project template, and make first_circle.py from step 8 the first file in it.
Hack: Draw five concentric circles from the McNeel sample by turning the radius into a loop. This loop is my own illustration, not McNeel text, and it uses only the calls you met above.
import rhinoscriptsyntax as rs
centerpoint = [1, 2, 4]
for i in range(1, 6):
rs.AddCircle(centerpoint, 5.0 * i)Press F5 and you get radii of 5, 10, 15, 20 and 25 units around the same centre. Change range(1, 6) to range(1, 11) to get ten circles. You changed two numbers and drew five more circles without touching the mouse.
PAZ has written about the office side of this before. The PAZ-Rhino launch piece asked which Rhino task your office repeats every week. This script is the smallest possible answer. PAZ Academy, a Rhino centre in Switzerland, teaches this path from first script to Grasshopper in its Rhino training.
Learn-it:
- McNeel: The Script Editor command: opening, running, breakpoints, the Terminal and Variables trays.
- McNeel: RhinoScriptSyntax introduction: the import and the circle sample.
- McNeel: Points in RhinoScriptSyntax: CreatePoint, AddPoint, AddLine.
- McNeel: Rhino.Python guides: overview, GhPython, and the Rhino.Python 101 Primer PDF.
- PAZ note: bring the Rhino task you repeat every week.
Open Rhino now, type ScriptEditor, and don’t close it until a circle you wrote yourself is on the screen.
PAZ Kaffi · multidisciplinary editorial, led by PAZ Academy