← Back to Skills Marketplace
jhauga

Rhino 3D Scripts

by John Haugabook · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
63
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install rhino3d-scripts
Description
Authoring and debugging scripts for Rhinoceros 3D (Rhino 8 and later). Use when asked to write RhinoScript (VBScript / .rvb / .vbs), RhinoPython, or RhinoCom...
README (SKILL.md)

Rhino 3D Scripting Skill

Write production-quality scripts for Rhinoceros 3D. Covers the three scripting surfaces (RhinoScript/VBScript, RhinoPython, direct RhinoCommon .NET) and the Rhino 8+ Script Editor.

When to Use This Skill

  • User asks to write, edit, or debug a .rvb, .vbs, or .py Rhino script
  • User wants a Rhino command macro or wants to automate a sequence of Rhino commands
  • User wants to manipulate geometry, layers, blocks, materials, viewports, or annotations from code
  • User mentions rhinoscriptsyntax, scriptcontext, RhinoCommon, Rhino.Geometry, RhinoDoc, or the Script Editor
  • User wants to pick objects, prompt for input, or build a small UI inside Rhino
  • User asks how to load, run, or distribute a script (startup scripts, aliases, toolbar buttons)

Choosing a Scripting Surface

Pick the surface based on the task, not preference. Recommend Python by default for new work.

Surface When to choose File ext
RhinoPython (rhinoscriptsyntax + RhinoCommon) Default for new scripts. Best ecosystem, readable, full RhinoCommon access. .py
RhinoScript (VBScript) Maintaining legacy .rvb/.vbs files; integrating with VBA/COM. .rvb, .vbs
RhinoCommon (C#/.NET) via Script Editor Performance-critical loops, complex geometry, leveraging .NET libraries. .cs
Command macro Pure sequence of existing Rhino commands; no logic. toolbar/alias

A macro is not a script — it is a string of command-line input (e.g. ! _-Line 0,0,0 10,0,0 _Enter). Use a script the moment you need a variable, loop, or conditional.

Prerequisites

  • Rhino 7 or later (Rhino 8 strongly recommended — unified Script Editor supports Python 3, VB, and C# in one window).
  • Script Editor: type _ScriptEditor (Rhino 8) or _EditPythonScript / _EditScript (older).
  • Run a saved file from the command line with _-RunPythonScript or _LoadScript + _RunScript.

Core Patterns

Python: minimal scaffold

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

def main():
    obj_id = rs.GetObject("Select a curve", filter=rs.filter.curve, preselect=True)
    if not obj_id:
        return
    length = rs.CurveLength(obj_id)
    print("Length: {0:.4f}".format(length))

if __name__ == "__main__":
    main()

Python: working with RhinoCommon directly

import Rhino
import scriptcontext as sc

doc = sc.doc  # Rhino.RhinoDoc.ActiveDoc
tol = doc.ModelAbsoluteTolerance

circle = Rhino.Geometry.Circle(Rhino.Geometry.Point3d(0, 0, 0), 5.0)
curve_id = doc.Objects.AddCircle(circle)
doc.Views.Redraw()

VBScript: minimal scaffold

Option Explicit

Call Main()

Sub Main()
    Dim strObject
    strObject = Rhino.GetObject("Select a curve", 4)  ' 4 = curve filter
    If IsNull(strObject) Then Exit Sub
    Rhino.Print "Length: " & Rhino.CurveLength(strObject)
End Sub

Picking objects with a custom filter (Python, RhinoCommon)

import Rhino
import scriptcontext as sc

go = Rhino.Input.Custom.GetObject()
go.SetCommandPrompt("Select breps")
go.GeometryFilter = Rhino.DocObjects.ObjectType.Brep
go.SubObjectSelect = False
go.GetMultiple(1, 0)
if go.CommandResult() != Rhino.Commands.Result.Success:
    pass
else:
    ids = [go.Object(i).ObjectId for i in range(go.ObjectCount)]

Step-by-Step Workflows

Bulk-modify many objects fast

  1. Disable redraw: rs.EnableRedraw(False).
  2. Wrap mutations in a single undo record: undo = doc.BeginUndoRecord("My Op")doc.EndUndoRecord(undo).
  3. Use RhinoCommon directly inside the loop (skip rhinoscriptsyntax overhead).
  4. Re-enable redraw and call doc.Views.Redraw() in a try/finally so a crash never leaves the viewport frozen.

Distribute a script to a teammate

  1. Save the .py / .rvb somewhere on disk.
  2. Add the folder to Options → Files → Search paths so Rhino can find it by name.
  3. Create a toolbar button or alias whose macro is:
    • Python: ! _-RunPythonScript "MyScript.py"
    • RhinoScript: ! _-LoadScript "MyScript.rvb" _-RunScript MySubName
  4. The leading ! cancels any running command; - runs the command in script (no-dialog) mode.

Run code at Rhino startup

  1. Place a .rvb/.py in a search path.
  2. Tools → Options → RhinoScript (or Python) → add to Startup list. The file executes once per session.

Gotchas

  • rhinoscriptsyntax returns GUIDs, RhinoCommon returns objects. Mixing them is fine, but doc.Objects.Find(guid) is the bridge from a rs.* id to a RhinoObject.
  • Coordinates differ by surface. Python uses (x, y, z) tuples or Rhino.Geometry.Point3d; VBScript uses 3-element Array(x, y, z). Never pass a Python list to a VBScript helper through COM.
  • Option Explicit is off by default in VBScript. Typos silently create new variables. Always add Option Explicit at the top of .rvb files.
  • VBScript has no block scope. All Dims inside a Sub are hoisted to the top of the procedure. Loop counters leak.
  • Nothing, Empty, and Null are different in VBScript. Use IsNull for Rhino.GetObject failure, IsEmpty for uninitialized Variant, Is Nothing for object refs.
  • Parentheses change calling semantics in VBScript. Call Foo(a, b) and Foo a, b are valid; Foo(a, b) (no Call, with parens) is not a call to a Sub — it’s a syntax error for multi-arg subs and a forced ByVal for single-arg.
  • Tolerance is per-document. Always read doc.ModelAbsoluteTolerance rather than hardcoding 0.001; users work in mm, m, inches, etc.
  • Long loops should poll Rhino.RhinoApp.EscapeKeyPressed so the user can cancel. Otherwise Rhino appears frozen.
  • GUID strings vs System.Guid. rhinoscriptsyntax accepts either; RhinoCommon wants System.Guid. Convert with System.Guid(str_id) if needed.
  • Don’t call doc.Views.Redraw() inside a tight loop. Toggle redraw once outside the loop.
  • .rvb is just .vbs renamed with a Rhino-specific extension so Rhino’s LoadScript recognizes it. Same VBScript engine.

Troubleshooting

Symptom Fix
rs.GetObject returns None immediately The user pressed Escape, or your filter excludes everything. Re-check rs.filter.* flags.
“Unable to find script” when running by name The folder isn’t in Options → Files → Search paths.
VBScript Type mismatch on coordinates You passed a 2-element array. Rhino requires 3-element Array(x, y, z).
Python ImportError: No module named Rhino You’re running CPython outside Rhino. RhinoCommon is only available in Rhino’s embedded Python (or via rhino3dm for read-only file work).
Created geometry doesn’t appear You forgot doc.Views.Redraw(), or rs.EnableRedraw(False) was never re-enabled.
Undo undoes only the last object of a batch Wrap the batch in BeginUndoRecord / EndUndoRecord.
Script works alone but fails as a startup script Startup runs before any document is open — guard with if sc.doc is not None.
rs.command("...") returns False The macro string is malformed. Prefix with ! and -, end every prompt with _Enter or a value.

References

Upstream docs

  • RhinoScript landing: \x3Chttps://docs.mcneel.com/rhino/8/help/en-us/information/rhinoscripting.htm>
  • Developer hub: \x3Chttps://developer.rhino3d.com/>
  • RhinoCommon API index: \x3Chttps://mcneel.github.io/rhinocommon-api-docs/api/RhinoCommon/html/R_Project_RhinoCommon.htm>
  • Example scripts repo: \x3Chttps://github.com/mcneel/rhino-developer-samples/tree/8/rhinoscript>
Usage Guidance
This skill appears safe to install as an instruction-only Rhino scripting helper. Before running any generated RhinoPython, RhinoScript, or command macro, review it for deletes, bulk edits, startup registration, file import/export, or no-dialog commands, and keep a saved backup of important Rhino models.
Capability Analysis
Type: OpenClaw Skill Name: rhino3d-scripts Version: 1.0.0 The skill bundle provides legitimate and comprehensive documentation for authoring and debugging scripts in Rhinoceros 3D using Python, VBScript, and RhinoCommon. The content, including SKILL.md and various reference files, focuses on standard CAD automation tasks, UI interaction, and geometry manipulation without any indicators of malicious intent, data exfiltration, or harmful prompt injection.
Capability Tags
crypto
Capability Assessment
Purpose & Capability
The skill’s purpose is clearly aligned with writing Rhino scripts and command macros, including geometry, layers, objects, and document operations. Those operations can materially change a Rhino file, so users should review generated code before running it.
Instruction Scope
The instructions include no-dialog command macros and an example that selects all and deletes objects. This is consistent with Rhino automation documentation, but destructive generated macros should require user confirmation.
Install Mechanism
There is no install spec, no code files, no required binaries, and no required environment variables or credentials; this is an instruction-only skill.
Credentials
The environment impact is proportionate to Rhino scripting: generated scripts may manipulate the active Rhino document and run local Rhino commands, but the artifacts do not show network access, credential use, or unrelated system access.
Persistence & Privilege
The artifacts document optional Rhino startup scripts, toolbar buttons, aliases, and search paths. This persistence is disclosed and purpose-aligned, but users should only add trusted scripts to startup locations.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install rhino3d-scripts
  3. After installation, invoke the skill by name or use /rhino3d-scripts
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of the Rhino3D scripting skill: - Author and debug scripts for Rhino 3D using RhinoPython, RhinoScript (VBScript), and RhinoCommon (C#/Python) APIs. - Covers scripting with rhinoscriptsyntax, scriptcontext, and direct access to Rhino’s .NET namespaces (Rhino.Geometry, etc.). - Provides guidance on automating Rhino tasks, writing macros, manipulating geometry and document objects, and integrating with the Rhino 8 Script Editor. - Includes best practices, core patterns in Python and VBScript, bulk automation workflows, and troubleshooting common scripting issues. - Guidance included for sharing, running, and troubleshooting scripts in various Rhino environments.
Metadata
Slug rhino3d-scripts
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Rhino 3D Scripts?

Authoring and debugging scripts for Rhinoceros 3D (Rhino 8 and later). Use when asked to write RhinoScript (VBScript / .rvb / .vbs), RhinoPython, or RhinoCom... It is an AI Agent Skill for Claude Code / OpenClaw, with 63 downloads so far.

How do I install Rhino 3D Scripts?

Run "/install rhino3d-scripts" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Rhino 3D Scripts free?

Yes, Rhino 3D Scripts is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Rhino 3D Scripts support?

Rhino 3D Scripts is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Rhino 3D Scripts?

It is built and maintained by John Haugabook (@jhauga); the current version is v1.0.0.

💬 Comments