AI · Scripting · Experiential Guide

Vibe Coding your Tools in Rhino 9

Vibe-code a circular speaker-grid pattern, then turn the finished script into a reusable Rhino command.

20 minRhino 9 for Windows / MacBeginner
Vibe Coding your Tools in Rhino 9

Rhino 9 makes it very easy to drive Rhino with AI. All you need is an MCP-compatible AI desktop application, such as Claude or ChatGPT. Make sure to be signed into your AI client account first, then open the AI panel in Rhino. Once opened, describe the geometry or task you want in plain language, watch the assistant build it live in your Rhino session, and refine it by continuing the conversation. In this tutorial, we’ll use this method to prototype a circular grid of holes, like a speaker grille, and then turn the finished script into a real, reusable SpeakerGrid command with its own command-line prompts.

Rhino does not include an AI subscription
Rhino has no AI of its own. It includes RhinoMCP, which lets you connect Rhino to an AI system you already use, whether it runs in the cloud or on your own computer.

What You’ll Need

  • Download Rhino 9 Evaluation for Windows or Mac.
  • An MCP-compatible AI desktop application. Supported apps are Claude Desktop and Codex.
  • A subscription to that AI service. Everything here was done on the standard Claude plan.
  • No Python knowledge required. The assistant writes and edits the script for you; some familiarity with Python is helpful, but not necessary, if you want to read along.
A Grain of Salt
This is an experiential guide, meaning we are sharing an experience which will most likely differ from yours by the time you get to it. Vibe-coding is not rule-based programming. The prompts in this guide are examples. What is relevant is the setup and sharing the experience of possibility, over an exact process. We hope it will be of help understanding how AI can improve your everyday workflows in Rhino.

Verifying your Connection

In this section, we will make sure we have the panel open and docked in a suitable way to start our conversation. We will verify that the client is connected. In this example, we are using Claude as our AI client.

  1. Open Rhino 9.
  2. Open the AI panel.
  3. If it is connected, it should say it is ready to go:
The AI Panel in Rhino connected to Claude
  1. If not, open the AI Settings to verify which Agent is available and eventually select a Model:
The AI Settings allows you to select an Agent and Model
  1. If it is still not connected, run /logout followed by /login by typing it directly in the AI Panel’s chat box. This should force the connection.

Prototype the Grid in Conversation

  1. With the bridge running, in the AI Panel, describe the pattern you’re after instead of writing it from scratch:

    Write RhinoScript-Python that draws a circular grid of small circles around a center point, arranged in concentric rings, like the holes in a speaker grille. Run it in Rhino so I can see it.

  2. The assistant writes the script and calls RhinoMCP’s execute_rhinoscript_python_code tool, which runs the code directly in your open Rhino document. The grille pattern appears in the viewport immediately, so you can keep iterating conversationally:

    Space the rings further apart near the center, and make the holes a bit smaller.

A speaker grid created with radius: 50, rings: 6 and hole radius: 4. The circles look randomly placed, which is not desired.

A speaker grid created with radius: 50, rings: 6 and hole radius: 4. The circles look randomly placed, which is not desired.

The Result Doesn't Hold Up
The circles don’t form clean rings. They look randomly scattered instead, because each ring’s hole count is derived independently from its circumference, so neighboring rings don’t line up into consistent spokes. Keep prompting AI Panel to fix the pattern rather than patching the script by hand:

  1. Tell the assistant what’s wrong and how you want it fixed:

    The holes look randomly scattered instead of forming clean rings. Update the script so each additional ring adds exactly 6 more circles than the ring before it, keeping them evenly spaced around the circle. Keep the original values obtained: center 0, overall radius 50, hole radii 4

  2. Let it run the updated script and check the result in the viewport.

    The same values, now with 6 more circles added per ring. Now the radial spokes are well aligned.

    The same values, now with 6 more circles added per ring. Now the radial spokes are well aligned.

  3. The assistant’s modified script should now look close to this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import rhinoscriptsyntax as rs
import math

def speaker_grid():
    center = rs.GetPoint("Center of the speaker grid")
    if center is None: return

    radius = rs.GetReal("Overall grid radius", 50.0)
    if radius is None: return

    rings = rs.GetInteger("Number of rings", 6, 1, 50)
    if rings is None: return

    hole_radius = rs.GetReal("Hole radius", 2.0)
    if hole_radius is None: return

    plane = rs.WorldXYPlane()
    plane.Origin = center
    rs.AddCircle(plane, hole_radius)

    for ring in range(1, rings + 1):
        ring_radius = (radius / rings) * ring
        hole_count = ring * 6
        for i in range(hole_count):
            angle = (2 * math.pi / hole_count) * i
            x = center.X + ring_radius * math.cos(angle)
            y = center.Y + ring_radius * math.sin(angle)
            hole_plane = rs.MovePlane(plane, [x, y, center.Z])
            rs.AddCircle(hole_plane, hole_radius)

speaker_grid()
  1. Download the fixed script: speaker_grid.py
Technical Shift
Vibe-coding lets people with little coding experience automate repetitive tasks, freeing them from the time spent getting those tasks to work. Now, the focus can shift to desired outcomes and design intent, where technical, geometric, and design knowledge matter most for directing the tool.

Save the Working Script

Once you’re happy with the result, save the script you downloaded above to disk somewhere permanent, for example Documents\Scripts\speaker_grid.py. You’ll point to it when turning the script into a command in the next step.

Checking the Script Yourself
Open it with Rhino’s ScriptEditor and test-run it by pressing before wiring it up as a command.

Turn the Script into a Command

To turn the script into a reusable command you can type in Rhino’s Command Prompt , pair it up with an Alias.

  1. Run the Options command and open the Aliases page.

  2. Click New, and set:

    Alias Command macro
    SpeakerGrid ! _-ScriptEditor Run "Documents\Scripts\speaker_grid.py"
  3. Close the Options dialog.

  4. Typing SpeakerGrid now runs your script exactly like a built-in command, prompts and all, any time, with no AI connection required.

From Circles to a Real Grille
The command creates flat circles as construction geometry. Select the outer boundary and holes, run ExtrudeCrv on a panel, then BooleanDifference the extruded holes out of a solid to get a real perforated speaker grille.

Add a Toolbar Icon

Typing SpeakerGrid works, but a clickable icon is faster to reach for a command you use often.

  1. Create a new button by right-clicking a gray area of the Standard Toolbar and choosing New Button….

  2. The Button Editor - Empty dialog appears:

    • For the Left Mouse Button Tooltip, enter Speaker Grid.
    • Under Command, enter the same macro you used for the alias:
    `!_-ScriptEditor Run "Documents\Scripts\speaker_grid.py"`
    
    • Under Appearance, in the top-left corner of the editor, select the Lightor Dark icon to open the built-in Image Editor. Draw an icon with the built-in tools.
    • Alternatively, go to File → Open to bring in an SVG you’ve made or use this example speaker-grill-icon.svg.
    • Select OK to close the Image Editor, then OK again to close the Button Editor.
  3. Select the new button to test it. It walks through the same prompts as typing SpeakerGrid at the command line.

Keep Custom Toolbars Safe
Buttons you add to Rhino’s default toolbar file get wiped out on a reinstall or a Reset. Before adding more than one or two, create your own RUI file first. Run the ( Toolbar command → File → New RUI File…. Follow the prompts to save the RUI file. See Customize Your Toolbars for a closer look at creating a toolbar and toolbar button.

Finished!
Congratulations on completing this tutorial! Feel free to continue using these tools to detail your design or create a new one from scratch. If you have any questions, ask us on Discourse or email our support team at support@mcneel.com.

Keep Exploring