execute_ruby
Run arbitrary Ruby code in SketchUp Make 2017 to inspect or modify the active model through the Ruby API, returning results and printed output.
Instructions
Execute arbitrary Ruby code inside SketchUp. The code runs at the top level (not inside the plugin's SU_MCP module; call its helpers as SU_MCP.name) and has full access to the SketchUp Ruby API (Sketchup, Geom, UI, etc.). Returns the result of the last expression and any puts/print output. SketchUp Make 2017 (Ruby 2.2): do NOT use Ruby 2.3+ syntax such as &. or <<~. The raw API works in inches: write lengths with SketchUp's unit helpers, e.g. 3.5.m or 20.cm. Solid-tool methods (union, subtract, intersect, trim, split, outer_shell) are SketchUp Pro only and fail in Make. Wrap edits in model.start_operation('Name', true) / model.commit_operation for a single undo step. Use with care — this can modify or delete model data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Ruby source code to execute |