rhino3d-scripts
它能做什么
这个智能体可以帮你为 Rhinoceros 3D 建模软件创建和修复脚本(代码)。它能理解该软件使用的几种脚本语言。
适用场景
- ✓想自动化 Rhino 中重复性的任务时。
- ✓需要新建脚本或修复已有脚本时。
- ✓想让 Rhino 以编程方式操作对象时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/rhino3d-scripts/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请写一个 Python 脚本,在场景中心画一个半径为 5 个单位的圆。”
每周 5 个新技能,1 分钟读完。
工作原理
这个智能体了解 Rhino 使用的脚本语言,比如 RhinoPython 和 RhinoScript。它可以生成用于操作几何体、图层以及软件其他元素的代码。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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.pyRhino 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
_-RunPythonScriptor_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
- Disable redraw:
rs.EnableRedraw(False). - Wrap mutations in a single undo record:
undo = doc.BeginUndoRecord("My Op")…doc.EndUndoRecord(undo). - Use RhinoCommon directly inside the loop (skip
rhinoscriptsyntaxoverhead). - Re-enable redraw and call
doc.Views.Redraw()in atry/finallyso a crash never leaves the viewport frozen.
Distribute a script to a teammate
- Save the
.py/.rvbsomewhere on disk. - Add the folder to
Options → Files → Search pathsso Rhino can find it by name. - Create a toolbar button or alias whose macro is:
- Python:
! _-RunPythonScript "MyScript.py" - RhinoScript:
! _-LoadScript "MyScript.rvb" _-RunScript MySubName
- Python:
- The leading
!cancels any running command;-runs the command in script (no-dialog) mode.
Run code at Rhino startup
- Place a
.rvb/.pyin a search path. Tools → Options → RhinoScript(orPython) → add to Startup list. The file executes once per session.
Gotchas
…
常见问题
脚本和宏有什么区别?
宏是一连串简单的命令,而脚本是更复杂的代码,可以包含逻辑判断、变量和循环。
我应该使用哪种脚本语言?
对于新项目,一般推荐使用 Python,因为它更现代,功能也更丰富。RhinoScript 主要用于维护旧代码。
怎么在 Rhino 中运行脚本?
你可以使用“_ScriptEditor”命令打开编辑器,粘贴代码后运行;也可以先保存脚本,再使用“_RunPythonScript”或“_LoadScript”等命令来运行。
详情
作者的原始描述
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 tasks; build command macros; manipulate Rhino geometry, layers, blocks, or document objects; pick objects from the viewport; control redraw and undo; or load and run scripts from the Rhino Script Edit
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7405
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。