RhinoClaw Skill
Control Rhino 3D directly via TCP socket connection to the RhinoClaw plugin. 72+ tools for geometry creation, BIM workflows, Grasshopper automation, and more.
Plugin: github.com/McMuff86/RhinoClaw · Author: Solid AI
Prerequisites
- 1. Rhino 7/8 running on Windows
- RhinoClaw plugin installed and built
- Plugin started: In Rhino command line, type
tcpstart (for WSL/remote access)
Note: Use mcpstart for local-only access (Cursor, Claude Desktop), tcpstart for WSL/Clawdbot.
Configuration
Copy config.example.json to config.json and edit:
CODEBLOCK0
CODEBLOCK1
Host IP depends on your setup:
- - Same machine: INLINECODE5
- WSL2 → Windows: Your gateway IP (
ip route show default | awk '{print $3}') - Remote (Tailscale/LAN): The IP of the Windows machine running Rhino
Quick Test
CODEBLOCK2
Scripts Reference
| Script | Purpose |
|---|
| INLINECODE7 | Base TCP client, raw commands |
| INLINECODE8 |
Create primitives (box, sphere, cylinder, curves...) |
|
transforms.py | Move, rotate, scale, copy, mirror, arrays |
|
booleans.py | Union, difference, intersection |
|
selection.py | Select by layer, type, name, IDs |
|
analysis.py | Object info, properties, bounding box, volume |
|
curves.py | Offset, fillet, chamfer, join, explode |
|
surfaces.py | Loft, extrude, revolve, sweep |
|
layers.py | Create, set, list, delete layers |
|
materials.py | PBR materials, assign to layers |
|
viewport.py | Views, camera, screenshots |
|
render.py | Lights, render settings, render to file |
|
files.py | Open, save, import, export (STEP, OBJ, STL...) |
|
groups.py | Groups and block definitions |
|
scene.py | Document info, batch operations |
|
presets.py | Preset & Template manager for GH definitions |
|
ghscript.py | GH Definition builder + Compute Platform deployer |
|
visualarq.py | VisualARQ BIM objects (walls, doors, windows, levels, IFC) |
|
utils.py | Shared utilities (parse
coords, parsecolor, format_result) |
🎯 Geometry Creation
CODEBLOCK3
Supported Geometry Types
| Type | Key Parameters |
|---|
| POINT | location |
| LINE |
start, end |
| POLYLINE | points |
| CIRCLE | center, radius |
| ARC | center, radius, angle |
| ELLIPSE | center, radius
x, radiusy |
| CURVE | points, degree |
| BOX | width, length, height |
| SPHERE | radius |
| CONE | radius, height |
| CYLINDER | radius, height |
| MESH | vertices, faces |
🔨 Solid Operations
CODEBLOCK4
🔄 Transform Operations
CODEBLOCK5
⚡ Boolean Operations
CODEBLOCK6
Note: Objects must be closed solids (Breps).
🎯 Selection
CODEBLOCK7
📊 Object Analysis
CODEBLOCK8
〰️ Curve Operations
CODEBLOCK9
🏔️ Surface Operations
CODEBLOCK10
📁 Layers
CODEBLOCK11
🎨 Materials (PBR)
CODEBLOCK12
📷 Viewport & Screenshots
CODEBLOCK13
Screenshots are saved directly to the Linux filesystem via WSL UNC path. The returned linux_path can be read directly.
💡 Render & Lighting
CODEBLOCK14
📦 Files (Import/Export)
CODEBLOCK15
Supported Export Formats
STEP, IGES, OBJ, STL, DXF, DWG, 3DS, FBX, DAE
📦 Groups & Blocks
CODEBLOCK16
🌿 Grasshopper Player Automation
Run Grasshopper definitions with custom parameters directly from CLI.
CODEBLOCK17
Parameter Discovery
CODEBLOCK18
How It Works
- 1.
info loads the GH file via Grasshopper SDK to extract parameter metadata - INLINECODE28 starts Rhino's GrasshopperPlayer via
SendKeystrokes (non-blocking) - Script monitors command prompts and sends parameter values
- INLINECODE30 prompts receive the
--Point coordinate or default INLINECODE32
Presets (YAML-based)
CODEBLOCK19
Presets are defined in config/presets.yaml, templates in config/templates.yaml.
🏗️ GH Definition Builder (NEW)
Programmatically create Grasshopper definitions with Python script components.
The full pipeline: Generate Code → Build .gh → Deploy to Compute Platform → Solve via API
Build a Definition via RhinoClaw
CODEBLOCK20
Build + Deploy to Rhino Compute Platform
CODEBLOCK21
After deploy, the definition is immediately solvable:
CODEBLOCK22
Input Spec Format (inputs.json)
CODEBLOCK23
GHPython Script Template
The script receives inputs as variables matching the input names:
CODEBLOCK24
Execute Python Directly in Rhino
CODEBLOCK25
How It Works
- 1.
build_gh_definition command in RhinoClaw creates a GH document with:
- Number Sliders / Boolean Toggles / Panels for each input
- A Python 3 Script component with the provided code
- Wired connections between inputs and script
- 2. The document is saved as binary
.gh file - INLINECODE37 copies to Compute Platform
definitions/ and writes INLINECODE39 - INLINECODE40 endpoint picks it up automatically
📜 RhinoScript Execution
CODEBLOCK26
🔍 Log Monitoring
Check the Rhino log for debugging (requires Windows filesystem access / TOTP):
CODEBLOCK27
Example: Complete PBR Scene Workflow
CODEBLOCK28
⚠️ Error Handling
The rhino_client.py provides custom exceptions for robust error handling:
| Exception | When |
|---|
| INLINECODE42 | Can't connect or connection lost |
| INLINECODE43 |
No response within timeout |
|
RhinoCommandError | Rhino returned an error |
|
ValidationError | Invalid parameters |
Auto-retry: The client has a @with_retry decorator for automatic reconnection with exponential backoff (default: 3 retries).
Context Manager: Use with RhinoClient() as client: for automatic connect/disconnect.
🏗️ VisualARQ BIM Objects (OPTIONAL)
Control VisualARQ BIM objects (walls, doors, windows, columns, beams, etc.).
Note: VisualARQ is an optional add-on. All commands gracefully degrade if not installed - no crashes or errors.
Check Availability
CODEBLOCK29
Walls
CODEBLOCK30
Doors & Windows
CODEBLOCK31
Position Parameter: 0.0 = start of wall, 1.0 = end of wall, 0.5 = middle
Structural Elements
CODEBLOCK32
Levels & Buildings
CODEBLOCK33
Custom BIM Parameters
CODEBLOCK34
Parameter Types: text, number, integer, boolean, INLINECODE52
IFC Import/Export
CODEBLOCK35
Supported IFC Versions: IFC2x3, IFC4, INLINECODE55
Query VisualARQ Objects
CODEBLOCK36
Example: Complete BIM Workflow
CODEBLOCK37
Troubleshooting
| Problem | Solution |
|---|
| Connection refused | Run tcpstart in Rhino command line |
| Timeout |
Increase timeout in config.json (max 120s) |
| Boolean failed | Ensure objects are closed solids (Breps) |
| Screenshot path issues | Check windows_dir UNC path in config |
| Command not found | Rebuild plugin after C# changes |
| Objects on wrong layer | Set layer first with
layers.py set "LayerName" |
| PBR material not visible | Materials use RenderMaterials table (fixed in 0.1.3.7+) |
| Script timeout | Use
--timeout 60 for large scripts |
|
RhinoConnectionError | Auto-retry is built in (3 attempts), check if plugin running |
| VisualARQ not available | Install VisualARQ plugin or gracefully ignore VA commands |
RhinoClaw 技能
通过 TCP 套接字连接直接控制 RhinoClaw 插件中的 Rhino 3D。提供 72 种以上工具,用于几何创建、BIM 工作流、Grasshopper 自动化等。
插件: github.com/McMuff86/RhinoClaw · 作者: Solid AI
前提条件
- 1. Rhino 7/8 在 Windows 上运行
- 已安装并构建 RhinoClaw 插件
- 启动插件:在 Rhino 命令行中输入 tcpstart(用于 WSL/远程访问)
注意: 使用 mcpstart 进行本地访问(Cursor、Claude Desktop),使用 tcpstart 进行 WSL/Clawdbot 访问。
配置
将 config.example.json 复制为 config.json 并进行编辑:
bash
cp config.example.json config.json
json
{
connection: {
host: YOURRHINOHOST_IP,
port: 1999,
timeout: 15.0
},
screenshots: {
linux_dir: ./captures,
windows_dir:
}
}
主机 IP 取决于您的设置:
- - 同一台机器: 127.0.0.1
- WSL2 → Windows: 您的网关 IP(ip route show default | awk {print $3})
- 远程(Tailscale/LAN): 运行 Rhino 的 Windows 机器的 IP
快速测试
bash
cd ~/clawd/skills/rhinoclaw/scripts
python3 rhino_client.py ping
脚本参考
| 脚本 | 用途 |
|---|
| rhino_client.py | 基础 TCP 客户端,原始命令 |
| geometry.py |
创建基本体(长方体、球体、圆柱体、曲线...) |
| transforms.py | 移动、旋转、缩放、复制、镜像、阵列 |
| booleans.py | 并集、差集、交集 |
| selection.py | 按图层、类型、名称、ID 选择 |
| analysis.py | 对象信息、属性、边界框、体积 |
| curves.py | 偏移、圆角、倒角、连接、炸开 |
| surfaces.py | 放样、挤出、旋转、扫掠 |
| layers.py | 创建、设置、列出、删除图层 |
| materials.py | PBR 材质,分配到图层 |
| viewport.py | 视图、相机、截图 |
| render.py | 灯光、渲染设置、渲染到文件 |
| files.py | 打开、保存、导入、导出(STEP、OBJ、STL...) |
| groups.py | 群组和块定义 |
| scene.py | 文档信息、批量操作 |
| presets.py | GH 定义的预设和模板管理器 |
| ghscript.py | GH 定义构建器 + Compute Platform 部署器 |
| visualarq.py | VisualARQ BIM 对象(墙体、门、窗、标高、IFC) |
| utils.py | 共享工具(解析坐标、解析颜色、格式化结果) |
🎯 几何创建
bash
基本体
python3 geometry.py sphere --radius 5 --position 0,0,0 --name 球体
python3 geometry.py box --width 10 --length 10 --height 5 --color 255,0,0
python3 geometry.py cylinder --radius 2 --height 8 --layer 零件
python3 geometry.py cone --radius 3 --height 6
python3 geometry.py line --start 0,0,0 --end 10,10,0
python3 geometry.py circle --radius 5
python3 geometry.py arc --radius 5 --angle 90
python3 geometry.py polyline --points 0,0,0 10,0,0 10,10,0 0,10,0
支持的几何类型
起点、终点 |
| 多段线 | 点集 |
| 圆 | 圆心、半径 |
| 圆弧 | 圆心、半径、角度 |
| 椭圆 | 圆心、半径
x、半径y |
| 曲线 | 点集、阶数 |
| 长方体 | 宽度、长度、高度 |
| 球体 | 半径 |
| 圆锥体 | 半径、高度 |
| 圆柱体 | 半径、高度 |
| 网格 | 顶点、面 |
🔨 实体操作
bash
圆角(倒圆)实体边缘
python3 solids.py fillet <对象_id> --radius 2.0
仅对特定边缘进行圆角
python3 solids.py fillet <对象_id> --radius 2.0 --edges 0,1,3
倒角边缘
python3 solids.py chamfer <对象_id> --distance 1.5
保留原始对象(不删除输入)
python3 solids.py fillet <对象_id> --radius 2.0 --keep
🔄 变换操作
bash
移动对象
python3 transforms.py move
--vector 10,0,0
旋转对象(绕通过点的轴旋转角度)
python3 transforms.py rotate --angle 45 --axis 0,0,1 --center 0,0,0
缩放对象
python3 transforms.py scale --factor 2.0 --center 0,0,0
带偏移复制
python3 transforms.py copy --offset 10,0,0
跨平面镜像
python3 transforms.py mirror --origin 0,0,0 --normal 1,0,0
线性阵列:沿 X 方向 5 个副本
python3 transforms.py linear --direction 1,0,0 --count 5 --distance 10
环形阵列:绕 Z 轴 8 个副本
python3 transforms.py polar --center 0,0,0 --axis 0,0,1 --count 8
⚡ 布尔运算
bash
多个实体并集
python3 booleans.py union
差集:从基础对象中减去切割器
python3 booleans.py difference id> id>
交集
python3 booleans.py intersection
保留输入对象(不删除)
python3 booleans.py union --keep
注意: 对象必须是封闭实体(Breps)。
🎯 选择
bash
全选
python3 selection.py all
清除选择
python3 selection.py none
获取选中对象信息
python3 selection.py get
按图层选择
python3 selection.py layer MyLayer
按对象类型选择
python3 selection.py type solid # 实体、曲线、曲面、网格、点等
按名称选择(部分匹配)
python3 selection.py name Box
按特定 ID 选择
python3 selection.py ids
组合筛选
python3 selection.py filter --layer 零件 --type solid
📊 对象分析
bash
基本对象信息
python3 analysis.py info <对象_id>
详细属性(边界框、面积、体积、质心)
python3 analysis.py properties <对象_id>
选中对象信息
python3 analysis.py selected
文档摘要
python3 analysis.py document
〰️ 曲线操作
bash
偏移曲线
python3 curves.py offset <曲线_id> --distance 5
两条曲线圆角
python3 curves.py fillet <曲线1id> <曲线2id> --radius 2
两条曲线倒角
python3 curves.py chamfer <曲线1id> <曲线2id> --distance 3
连接曲线为复合曲线
python3 curves.py join
炸开复合曲线为线段
python3 curves.py explode <复合曲线_id>
保留输入(不删除)
python3 curves.py join --keep
🏔️ 曲面操作
bash
通过曲线放样
python3 surfaces.py loft <曲线1_id>