Skip to content
d3 Wiki
10.03

RhinoPython / RhinoScript standards

Scripts that are readable, testable, and safe to run on a live model.

Updated
Oct 3, 2026
On this page

Purpose

Scripts that are readable, testable, and safe to run on a live model.

The standard

  • Python 3 (Rhino 8 _ScriptEditor) with rhinoscriptsyntax for simple ops and RhinoCommon (Rhino.Geometry) for anything geometric or performance-sensitive.

  • Structure: tool_name/ package with core/ (pure geometry math, no Rhino imports — unit-tested with pytest outside Rhino), rhino/ (document I/O), and run.py entrypoint.

  • Every script: starts with a docstring (what, inputs, outputs, layers touched), wraps changes in an undo record (sc.doc.BeginUndoRecord/EndUndoRecord), and prints a one-line summary at the end.

  • Inputs via rs.GetObjects/GetOption or a small Eto dialog; never hard-coded paths. Config in a settings.json next to the script.

  • Writes to TMP:: or explicit output layers only; never modifies input geometry without an option.

  • Follows 04.02 for style; print allowed for the Rhino console.

Procedure — new tool

Scaffold from template-rhino-plugin → write core/ with tests → wire rhino/ → add a catalog page (10.06) → package (06.07).

Anti-patterns

800-line single scripts; rs.AllObjects() on a large model; catching all exceptions and continuing.

Owner: [TEAM] · Last reviewed: 2026-09