Week 5 - Python and LLMs as Rhino Interfaces
Tuesday 10/27
Agenda
Review and Discuss
(20 min)
- Discuss Reading 4: Pattern and Ornament (Iwamoto; Picon)
- Show and Tell: Pattern Object
- Show and Tell: Midterm project proposal.
Handing Over the Design
We have been exploring successive ways to abstract design processes and use computation to produce form.
Week 1 was hand authored geometry. Week 2 was driven with parameters and sliders in Grasshopper. Week 3 explored data-driven form, where the designer chooses a mapping. Last week we set attractors and optimized towards seed points.
This week we are exploring Python (computer code) to author forms, LLMs to author that python code, and then LLMs with MCP to directly code and run code in Rhino.
Questions for today:
- Authorship: what are you still deciding? What did you give up this time?
- Black-boxing: can you explain every line or component the tool produced? Does it matter?
- Verification: how do you know it’s right — not just that it looks right?
- Corpus: an LLM proposes structure from patterns in its training data (week 3’s “data as corpus”). Whose patterns does it reproduce?
Before Class: Setup
Required (everyone): Rhino 8 with the Script Editor working. Try it out: enter the command ScriptEditor. (just like how we launch Grasshopper)
Optional (to follow along in part 4):
- Install McNeel’s free Rhino MCP plugin from the Package Manager. Mac: Apple Silicon only; Windows: x64 or ARM.
- An AI client the plugin supports. Free options:
- GitHub Copilot (in VS Code) is free for verified students through GitHub Education. Verification can take several days.
- A local model through LM Studio: free and private, but needs a capable laptop.
- Non-free options: Claude/Claude Code, Gemini CLI, OpenAI Codex.
- Check which chip your laptop has (Apple menu → About This Mac, or Windows Settings → System → About).
I will demo paid options. Nothing today requires paid models.
Demos
1. Programming Interfaces to Rhino and Grasshopper
(30 min) Demo and Hands-on.
So far we have used Grasshopper to program Rhino. Python provides another path. This is what an LLM will write for you late today, so you need to be able to read it.
Rhino has a built in python interface. (As many other graphics softwares do—-Maya, Blender, etc.).
- 🖐️ Who has used python before? 🖐️
- Rhino’s python interface, Rhino.Python, can be run in the built in script editor or as part of a grasshopper component.
- To import the Rhino.Python in the Rhino 8 Script Editor:
import rhinoscriptsyntax as rs, then commands like rs.AddPoint, rs.AddCircle, rs.Distance. When you run the script (play button) it will run the script once, adding geometry to the document.
- We will also make use of Python in Grasshopper. This will be a grasshopper component that contains python code, specifies inputs and outputs, and will rerun whenever its inputs change (just like any other component).
- To start, we will rebuild the rebuild the week 4 attractor screen in about 15 lines — a grid of points, the distance from each to an attractor point, a circle whose radius is remapped from that distance.
- We want to be able to read this code: loops, lists, function calls, component inputs/outputs.
Example files:
- 01_attractor_rhinopython.py: this example implements attractor screen in about 25 lines of
rhinoscriptsyntax. Open it in the Script Editor (ScriptEditor) and press Run, in a millimeter document. It will produce a 200 × 200 mm grid of circles, each with a radius of 1–6 mm proportional to its distance to the attractor point (60, 140). The grid of circles has a 14 mm spacing, and radii are capped so that neighbouring holes always keep 2 mm of wood between them. The settings at the top use the same names as the sliders in file 02 (grasshopper implementation)
- 02_attractor_ghpython.gh: this implements the same logic within a Python 3 script component. It uses sliders for spacing, radius range and minimum bridge, and an attractor point you can reference from Rhino and manipulate in the GUI. It reruns whenever an input changes, and outputs geometry instead of adding it to your document.
2. LLMs Generate Python
This example works with your preferred LLM, either local (on a laptop, if you run local models) or on a c loud provider.
I will demonstrate it with TritonGPT, UCSD’s own on-campus model.
Starting Questions:
- 🖐️ What models do you prefer?
- 🖐️ Have you used TritonGPT?
- Let’s try asking a chatbot for the same attractor screen, e.g.:
“Write RhinoPython (rhinoscriptsyntax, Python 3, Rhino 8) that makes a 200 × 200 mm screen: a grid of circles whose radius goes from 1 to 6 mm based on distance to a point at (60, 140), with at least 2 mm between neighboring holes.”
- Paste into the Script Editor and run it. Did it run the first time? If not, paste the error back in and see what it does.
- Compare to the hand-written version from part 1, line by line. What did it assume you meant?
- Verify (the most important step of the day):
- push the inputs to extremes (attractor at a corner, radius range 0.5–10)
- closed curves? duplicates? minimum bridge width actually respected?
- units: mm or inches?
- Now try a looser prompt, the kind that invites subtle mistakes:
“Write a Rhino Python script that makes a 200 x 200 laser-cut screen. Fill it edge to edge with a grid of circular holes. The hole radius should go from 1 to 6 based on the distance to an attractor point at (60, 140). Keep at least 2 mm between neighboring holes. Use rhinoscriptsyntax.”
It never says which way the radius should go, asks for “edge to edge”, and doesn’t mention units. Run the verification checklist on whatever comes back. Things to look for: holes hanging off the edge, bridges under 2 mm, duplicate circles, big holes where you wanted small ones, and no unit check.
- Ending Questions:
- 🖐️ What approaches do you have for testing/verifying or better yet, understanding the output of generative models?
- 🖐️ Where do you learn about how to do things when working with models to generate your code?
Example file:
- 03_llm_attractor_annotated.py: an LLM-style answer to the looser prompt, with each problem marked
# CHECK: and what to test (unit assumption, minimum bridge not enforced, holes over the edge, inverted remap, duplicate circles, a wrong hole count). It runs without errors and looks right at a glance. The prompt and the verification checklist are at the top of the file. This is a teaching example in the style of chatbot output, not captured from one model.
3. Intro to MCP

What is Model Context Protocol (MCP)?
Key concepts:
- Model Context Protocol (MCP) is a standard way for an AI client (Claude, Copilot, a local model) to call tools that a program exposes. An MCP server for Rhino exposes tools like “create geometry,” “run a script,” “read the layers.”
- Process flow with MCP: end user interacts with chat client <–> MCP <–> Rhino plugin <–> your model.
- In the previous two steps you ran the code, and saw its contents (should you choose to look). Here the agent is running the code directly from your prompt and file.
Questions:
- 🖐️ What does this change about checking your work?
- 🖐️ Learning?
- 🖐️ Remaining in the creative loop?
- 🖐️ What are other examples of MCP that you are familiar with? Take a minute to research.
4. RhinoMCP
(20 minutes) DEMO. Only follow along in pairs if you have access to a model capable of MCP.
Using McNeel’s free Rhino MCP plugin:
- Build: prompt the agent to make the attractor screen directly in Rhino.
- Extend a student’s definition: take a week 4 Pattern Object and ask for a change — “add a second curve attractor,” “make it fit a 32 mm sill,” “put laser-ready curves on a ‘cut’ layer.”
- Same prompt, three runs: run one prompt three times. Compare. This mirrors the 3-instance test, but the variation is uncontrolled: is it parametric variation, or noise?
- Agent → fabrication prep: ask it to check a mesh for printability (naked edges, wall thickness, bed size), then confirm with Rhino’s own
Check, ShowEdges, MeshRepair.
Tips:
- Save Grasshopper files as .ghx (XML) when you want an agent to read a definition; .gh is binary.
- The plugin is new; expect rough edges. Save before letting an agent edit your file.
5. Raven and Custom LLMs
Raven (free plan): “the AI for Rhino & Grasshopper.” Describe what you want and it works directly in Rhino and Grasshopper — modeling, editing, or building Grasshopper components — with no Python for you to read in between.
- Demo: the attractor screen, one more time.
- Compare to part 2: which one can you debug? Which one can you read?
Custom LLMs
- Local models (LM Studio, connected to the same Rhino MCP plugin): free and private, run on your own laptop, but smaller and more error-prone.
- Context: giving a model your own examples, conventions, or course files changes what it produces. A model is shaped by what it’s shown.
Discussion: whose patterns does each tool reproduce? (Picon on digital ornament; week 3’s “data as corpus.”)
Optional: Blender as an alternative to Rhino/GH
For anyone interested, Blender also has MCP interfaces. And we can try blender as an alternative to Rhino/GH.
Everything we did today in Rhino has a Blender equivalent, Blender is free on every platform, and many of you have used it before:
| Rhino / Grasshopper |
Blender |
RhinoPython (rhinoscriptsyntax, Rhino.Geometry) |
Blender Python (bpy), in the Scripting workspace |
| Grasshopper |
Geometry Nodes |
| McNeel’s Rhino MCP plugin |
MCP for Blender (formerly BlenderMCP), free and open source |
The likely MCP → Blender route (from the project’s README; check the repo directly for the current steps):
- Install Blender 3.0 or newer and the
uv Python tool manager: brew install uv on Mac, winget install --id=astral-sh.uv -e on Windows. Use uv’s own installer, not pip install uv.
- Install the add-on (
uvx mcp-for-blender install-addon, or download addon.py from the repo), then enable Interface: MCP for Blender in Edit → Preferences → Add-ons.
- In the 3D viewport press N, open the MCP for Blender tab, and start the server.
- Point an MCP client at it, e.g. Claude Desktop (Settings → Developer → Edit Config):
{ "mcpServers": { "blender": { "command": "uvx", "args": ["mcp-for-blender"] } } }
Cursor, VS Code, Claude Code and others are documented in the README. Run only one client against it at a time.
- Prompt for the attractor screen: a 200 × 200 mm plate, 3.2 mm thick, with holes whose radius goes from 1 to 6 mm by distance to (60, 140) and at least 2 mm between them. Then ask it to describe what it built.
Things that are different in Blender
- Units: Blender’s default unit is the meter. Set Scene Properties → Units → Length to Millimeters (Unit Scale 0.001) before you start, and say “millimeters” in every prompt.
- Meshes, not NURBS: holes are mesh booleans or cut-outs, so circles become polygons. Fine for printing: export
.stl. For a laser file, bring the result back into Rhino to make clean curves on a CUT layer.
- Verify the same way: run the week 5 checklist (units, bridge width, edges, duplicates, extremes) on whatever it builds.
- Safety: the add-on lets the agent run any Python inside Blender, and its server has no authentication: keep it on your own machine (localhost), and save before you let an agent edit your file. Its built-in 3D-model generators and some asset services need accounts or paid keys; you don’t need them for this.
Midterm Work
Generative Hands-On
(20 minutes) individual.
Use one of the methods above (LLM to generate python, MCP to control Rhino, Raven, Blender and MCP/llm) to try to generate some element of your midterm project. Work in pairs if you prefer.
What works? What doesn’t?
We will share at the end of class.
Wrap-up: Midterm Check-In
- Individual Check-Ins on Midterm.
- Get feedback from your peers and instructor.
Homework
Complete Midterm
Complete your midterm piece. Midterm Critique is in two weeks(Week 7). See Project 1. We will continue with other material next week.
If you use an LLM or other generative tool on the project, assemble this supplementary document:
AI Process Log
If you use AI tools for your midterm project, document the process in your sketchbook:
- the prompts you used (copy/paste)
- what the agent produced (screenshots)
- what you kept, changed, or threw out — and why
- one thing you verified, and how
Reading 5: Compression, Averages, and Authorship
Read both:
- Chiang, T. “ChatGPT Is a Blurry JPEG of the Web.” The New Yorker, February 2023. (TK: link)
- Steyerl, H. “Mean Images.” New Left Review 140/141, 2023. (TK: link/PDF on Canvas)
Response prompt on Canvas.
DUE Monday 11/2 EOD. Post your response to the discussion forum. We’ll discuss it in Week 6.
References
Authorship, craft, and the black box
- Sennett, R. The Craftsman. Yale University Press, 2008. “Machines” chapter (on CAD and drawing by hand).
- Latour, B. Pandora’s Hope. Harvard University Press, 1999. Ch. 6, “On Technical Mediation” (black-boxing).
- McCullough, M. Abstracting Craft: The Practiced Digital Hand. MIT Press, 1996.
- Zylinska, J. AI Art: Machine Visions and Warped Dreams. Open Humanities Press, 2020 (open access).
AI and architecture / design
- Leach, N. Architecture in the Age of Artificial Intelligence. Bloomsbury, 2022.
- Chaillou, S. Artificial Intelligence and Architecture: From Research to Practice. Birkhäuser, 2022.
- Carpo, M. The Second Digital Turn. MIT Press, 2017.