eval_ruby
Execute Ruby code inside SketchUp to create or edit 3D geometry and return the last expression as a string.
Instructions
Run Ruby code inside SketchUp (full SketchUp Ruby API) and return the value of the last expression as a string.
This is the main modelling tool. Rules that avoid the usual mistakes:
- Lengths are inches internally. Write 3.m, 150.mm, 15.cm, never bare numbers.
- model = Sketchup.active_model; wrap edits in
model.start_operation('name', true) ... model.commit_operation.
- A face on the ground plane (z=0) has its normal pointing down, so
pushpull(+h) would go underground: face.reverse! if face.normal.z < 0.
- Create each element with SU_MCP.element(name, kind, parent) { |ents| ... }
so it gets the standard tag and material; parent = SU_MCP.container('Rumah A').
- End with SU_MCP.audit_model; the work is done only when it says AUDIT OK.
- Make the last expression a short summary string (counts, bounds) so you
can verify the result. Calls time out after about 15 seconds, so split
very large jobs into several calls.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "eval_ruby"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |