MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Rhino3D-Scripts

Rhino3D-Scripts是一款code方向的AI技能,核心价值是Authoring and debugging scripts for Rhinoceros 3D (Rhino 8 and later),可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Authoring and debugging scripts for Rhinoceros 3D (Rhino 8 and later). Use when asked to write RhinoScript (VBScript / .rvb / .vbs), RhinoPython, or RhinoCommon-based scripts; automate Rhino modeling

Last verified on: 2026-05-30
mkdir -p ./skills/rhino3d-scripts && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/rhino3d-scripts/SKILL.md -o ./skills/rhino3d-scripts/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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


python
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


python
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


vbscript
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)


python
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 w

🎯 Best For

  • Debugging engineers
  • QA teams
  • Claude users
  • GitHub Copilot users
  • Software engineers

💡 Use Cases

  • Tracing runtime errors in production logs
  • Identifying memory leaks
  • Python code quality enforcement
  • Dependency management

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Rhino3D-Scripts to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Can this debug production issues?

Yes, but always ensure you have proper logging and monitoring in place first.

Is Rhino3D-Scripts compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Rhino3D-Scripts?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Rhino3D-Scripts?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/rhino3d-scripts/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Debugging without context

Always provide the full error stack and surrounding code context for accurate debugging.

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills