Write copy-paste-ready Rhino and Grasshopper node scripts for C# Script, Python 3 Script, and legacy IronPython 2 workflows without drifting into plugin development.
This repository contains a Codex-native skill for people who need practical Grasshopper node code quickly and accurately.
It helps with:
- detecting the locally installed Rhino and Grasshopper version before writing code
- detecting the available Python and C# scripting runtimes on the machine
- generating
GH_ScriptInstance-compatible C# code for Rhino 8 script components - generating Python 3 or IronPython 2 node code matched to the detected environment
- keeping script nodes neutral on empty or disconnected optional inputs
- shaping
RunScript(...)signatures so Grasshopper creates useful inputs and outputs - preserving practical node behavior such as no red or orange state for idle inputs
- verifying ambiguous RhinoCommon APIs against the locally installed
RhinoCommon.xml - using a curated gotcha registry for high-risk geometry semantics
- accumulating persistent user-specific rules in
references/custom-rules.md - keeping the whole workflow inside script nodes instead of compiled
.ghaplugins
- Rhino and Grasshopper users who need code pasted directly into script components
- Codex users who want a reusable skill for Grasshopper scripting tasks
- teams that want more reliable script generation than generic LLM answers usually provide
Many Grasshopper scripting requests fail because assistants mix up:
- script nodes vs compiled plugin development
- Rhino versions and runtime availability
- tricky RhinoCommon semantics around surfaces, faces, trims, or data trees
This repo is designed to reduce those mistakes by using local environment detection, curated gotchas, and exact documentation lookup.
Copy or clone this folder into your local Codex skills directory:
- Windows:
C:\Users\<you>\.codex\skills\grasshopper-script-nodes - or any Codex-indexed skills path used by your environment
Then restart Codex.
You can also install the current repo copy with:
powershell -ExecutionPolicy Bypass -File .\scripts\run_python.ps1 .\scripts\install_skill.py --source . --target "$env:USERPROFILE\.codex\skills"Typical prompts:
- "Write a Grasshopper C# script that does ..."
- "Write a Rhino 8 Grasshopper node script for ..."
- "Give me Python 3 code for a Grasshopper script component"
- "Keep the node neutral when optional inputs are empty"
- "Treat this as a new rule for future node code"
This skill should be used automatically when a user asks for Grasshopper script-node code, even if they do not explicitly mention the skill by name.
Strong markers include:
Grasshopper,GH,Rhino node,script node,C# Script,Python Script- requests like "write a script for a Grasshopper node"
- requests for code that can be pasted directly into a Rhino or Grasshopper node
- requests to auto-create inputs and outputs through the
RunScript(...)signature - requests to keep the node from going red or orange on empty inputs
- requests to remember future generation preferences as rules
Expected behavior:
- detect the local Rhino environment first
- read default rules, failure modes, custom rules, and gotchas
- choose C# vs Python based on the request
- choose Python 3 vs IronPython 2 only when compatibility requires it
- verify ambiguous geometry APIs against local RhinoCommon docs
- return code that is directly pasteable into the node
This repo intentionally does not rely on memory alone for RhinoCommon geometry semantics.
The trust hierarchy is:
- local
RhinoCommon.xml - official Rhino developer docs
- official McNeel sample code
- curated gotcha registry in this repo
- community forum threads
This is the core design choice that makes the skill more stable on geometry-heavy tasks such as trimmed surfaces, isocurves, domains, and face orientation.
SurfacevsBrepFacevsBrep- trim-aware behavior and underlying surfaces
IsoCurvedirection semanticsTrimAwareIsoCurvereturningCurve[]DivideByCountreturning parameters- face orientation and normals
- boundary, seam, and singularity issues
- accidental
ItemvsListvsTreeaccess mismatches
SKILL.md: the main Codex skillagents/openai.yaml: Codex UI metadatareferences/default-rules.md: default behavior for Grasshopper node generationreferences/common-failure-modes.md: common categories of script generation failurereferences/custom-rules.md: persistent user-specific generation rulesreferences/official-rhino-notes.md: official-doc-derived Rhino and Grasshopper notesreferences/rhinocommon-gotchas.json: machine-readable high-risk API facts and remindersscripts/check_gotcha_registry.py: validates the gotcha registry schemascripts/detect_rhino_environment.py: local Rhino, Grasshopper, and runtime detectorscripts/lookup_rhinocommon_docs.py: local RhinoCommon XML lookup for exact API semanticsscripts/update_custom_rules.py: appends new persistent rules to the custom rules filescripts/install_skill.py: copies the repo into a discoverable Codex skills pathscripts/check_skill_md.py: validates skill frontmatter and body presencescripts/inspect_skill_repo.py: quick repo structure validationscripts/run_python.ps1: resilient Python launcher for Windows environments with brokenpythonshims
- "Write a Grasshopper C# script that does ..."
- "Напиши скрипт для ноды Grasshopper"
- "Give me Python 3 code for a Rhino 8 Grasshopper node"
- "Make this GH node stay neutral when no mesh is connected"
- "Create inputs and outputs from the RunScript signature"
- "Use IronPython 2 because this must stay compatible with an older setup"
- "This is a rule, remember it for future node code"
powershell -ExecutionPolicy Bypass -File .\scripts\run_python.ps1 .\scripts\check_skill_md.py SKILL.md
powershell -ExecutionPolicy Bypass -File .\scripts\run_python.ps1 .\scripts\check_gotcha_registry.py .\references\rhinocommon-gotchas.json
powershell -ExecutionPolicy Bypass -File .\scripts\run_python.ps1 .\scripts\inspect_skill_repo.py .
powershell -ExecutionPolicy Bypass -File .\scripts\run_python.ps1 .\scripts\detect_rhino_environment.py --pretty
powershell -ExecutionPolicy Bypass -File .\scripts\run_python.ps1 .\scripts\lookup_rhinocommon_docs.py --member Surface.IsoCurve --member BrepFace.TrimAwareIsoCurve --prettyThe repo includes a local environment detector that reads Rhino installation metadata from Windows and inspects Rhino-side scripting assemblies.
On the machine where this repo was prepared, it detected:
Rhino 8.27.26019.16021Grasshopper 8.27.26019.16021Python 3.9runtime available in Rhino 8IronPythonassemblies also presentC# 9.0as the safe compatibility recommendation for generated C# node code
See install-flow-report.md for the packaging approach and install-report-sample.md for a sample environment report.
This repo is for script-node generation only. It is not a framework for compiled Grasshopper plugin architecture.
MIT. See LICENSE.txt.