SketchUp Ruby Code Editor

An easy-to-use code editor for Ruby right within SketchUp

SketchUp Ruby Code Editor


This code editor extension offers an easy-to-use and visually appealing way to write and modify Ruby scripts directly within SketchUp. These scripts can then be used to create geometry, add functionality or add data within the SketchUp 3D modeling environment. The SketchUp Ruby API provides an extensive set of functions to automatize SketchUp in many ways or create scripted, computational geometry.

I created this editor mainly for two reasons: One is that I wanted a way to edit and run SketchUp Ruby code right inside of SketchUp’s 3D modeling environment. Often this is done in an external editor, but having an internal editor allows for using both scripting and modelling concurrently – depending on your needs. The editor had to provide easy access to the Ruby coding environment and behave more like a real code editor. To accomplish this, I added a bit of jQuery (and jQuery UI) magic to make it look good and have some additional visual features (e.g. the tabs and menus). I also added the excellent CodeMirror syntax highlighting engine. This provides the editor with multi-language code highlighting, correct TAB control, find/replace, bracket matching, code folding, and many other features. Just load the plugin and give it a try to see for yourself how easy it is to use!

The other reason for this extension is that when I write code, I permanently need to look up documentation. To make this easier, I added a bunch of reference webpages to a browser window. Also, a dropdown below the editor contains some common code snippets that can be inserted at the current cursor position. I am also experimenting with a code-completion feature that you can invoke at any point by clicking CTRL-SHIFT. It contains SketchUp’s classes and methods.

By the way: Check out my book, “Architectural Design with SketchUp: 3D Modeling, Extensions, BIM, Rendering, Making, and Scripting.” Chapter 7 provides an overview of Ruby scripting in SketchUp and has many tutorials for things to do with this editor.

The following video gives a brief overview of what this editor can do:

And this video highlights the latest updates:


  • Beautiful and clean editor user interface with menu-based UI
  • Light / dark themed editor
  • Allows executing multi-line Ruby code directly in SketchUp
  • Works with files of any size
  • Fast opening and code highlighting of large files
  • Most recently used file list
  • Keyboard shortcut navigation
  • Line numbering in editor
  • Indenting/dedenting of code blocks
  • Matching brackets, current line highlighting
  • Undo/redo in editor
  • Find/replace in editor (text or RegEx)
  • Code folding
  • Insert code snippets at cursor
  • Code-completion for SketchUp classes and methods
  • Automatic backup file creation
  • Various options: font size, tab/space indenting
  • Undo of code execution
  • Single undo option for entire code
  • Results window keeps track of run history
  • Possibility to run external Ruby files
  • Reference web browser for common websites
  • Explore selection object properties and attributes
  • Option for direct access to the Ruby console
  • Option to edit default code snippet
  • Clean printing of code


Select Window > Ruby Code Editor or open from the Ruby Code Editor toolbar.

For detailed instructions, visit the Ruby Code Editor Manual.

Did you find this extension useful? Contribute to its development with any amount (via PayPal):


Editor dialog with File menu (light color style)
Editor dialog with Edit menu (dark color style)
Editor preferences
Editor and reference browser windows

Show Off Your Work

Did you create something amazing with this extension? I would love to see it! You can either upload an image in the comment section below (public) or privately send it to me.

Next Steps


You can now find this extension in Trimble’s Extension Warehouse. For an easy install (and update notifications), browse to it from inside SketchUp (2013 or newer) and install it directly.

Alternative Downloads

Linked below are the installation files (RBZ and ZIP formats) for the current and some previous versions of this extension.

To install these files, follow the SketchUp folks’ instructions. You can also find this extension on GitHub.

Revision History

  • Version 4.3 (5/7/2020)
    – Ruby working dir changes to file dir on load/save now
    – File path shows in tab title attribute
    – Added menu item to open plugin folder
    – Added function and menu item to run (load) external file instead of editor
    – Now prints error line numbers in feedback
    – Fixed 2020 GC issue (class var for browser)
    – Updated links in reference browser
    – Updated UI colors to be more consistent with SU
  • Version 4.2 (9/5/2019)
    – Fixed .to_l nil comparison issue
    – Added some backcomp fixes (works down to SU8)
    – Error handling for invalid filetypes
    – Fixes $LOAD_PATH inclusion, now sets at code execution
    – Adds proper filetype selectors to open dialog
  • Version 4.1 (7/18/2017)
    – Resubmission to fix EW signing issue
    – Minor fixes and edits
    – Fixed selection reporting
    – Separated selection menu
    – Created new SVG icons
    – Added definition attribute reporting
    – Added inserting of IDs
    – Added more menu tooltips
  • Version 4.0 (7/10/2017):
    – Code cleanup
    – Updated jQuery, jQueryUI, codemirror
    – Updated styles
    – Updated code snippets
    – New menu and tab UI
    – Ref browser and help windows use HtmlDialog now, also separate windows
    – Fixed loading code
    – Fixed recent file bug. Opens in current folder now
    – Fixed printing
    – Fixed preferences
    – Fixed eval binding to be top level (like the Ruby Console)
    – Made line wrapping default
    – Added preloading of optional $LIBRARY_PATH items from preferences
    – Added MRU file list
    – Added quick save option
    – Added undo/redo
    – Added find/replace
    – Added code folding
    – Added ability to edit default code
    – Added help window (link to website)
    – Improved keyboard shortcuts
    – Improved reference browser, updated links
  • Version 3.2 (4/25/2013):
    – Reorganized files and folders
  • Version 3.1 (3/6/2013)
    – Fixed default file bug
    – Updated jQuery cookie plugin
    – Fixed Tab problem
  • Version 3.0 (3/4/2013)
    – Got rid of settings file
    – Results feedback now wrapped in Paragraph
    – Improved feedback scrolling
    – Some CSS changes, separated CSS by theme
    – Two editor themes now: ambiance and eclipse
    – Updated Codemirror to 3.1
    – Updated jQuery
    – Updated jQuery UI
    – Improved editor stability, smoother scrolling
    – Set IE version number to 9 (allows for more features and better display)
    – Fixed SU class highlighting and added SU method highlighting
    – Added syntax highlighting for SketchUp classes and methods
    – Better editor closing handling
    – Changed some options for newer Codemirror
    – Fixed theme color options
    – Better error display
    – Fixed Mac rendering of results window
    – Fixed Mac default folder issue
  • Version 2.1 (2/26/2013)
    – Uses most recently used directory for file loading and saving
    – Fixed the outdated URLs in the browser
    – Update checking now uses
  • Version 2.0 (4/12/2011)
    – Switched editor to use CodeMirror – sooo much better!
    – Added code coloring for several languages (Ruby, HTML, CSS, JavaScript, XML, C/Java)
    – Can handle large files easily
    – Added bracket matching
    – Added coloring changer
    – Disabling run button if code is not Ruby
    – Added some more options
    – Added option to disable single undo
    – Added color coding for SU classes
    – Fixed problem with loading/saving slashes in files
    – Updated jQuery and jQuery UI
    – Results window is now continuous and scrolls
    – Added some more code snippets to dropdown
    – Added toolbar item
    – Moved menu item to “Windows” menu
    – Added settings file for modifications
    – Added code printing
  • Version 1.2 (4/13/2010)
    – Updated jQuery UI to v. 1.8
    – Added object explorer button to show current selection details
    – Added attribute explorer button for selection attributes
    – Added button to show Ruby console
    – Modified code a bit
    – Changed buttons to images for space reasons
    – Fixed keyboard access (Alt+…)
    – Added pages to browser: Edges to Rubies, Ruby core and Google search
    – Added basic update checking
    – Enabled browser buttons again – use at your own risk…
    – Waiting icon shown while code executes
  • Version 1.1.2 (3/8/2010)
    – Removed nav buttons also for IE because they disabled code execution after a while
    – Renamed some code elements
    – Added wrapper module
  • Version 1.1.1 (2/25/2010):
    – Safari-related fixes (cookies, text insert, removed back button)
  • Version 1.1 (2/22/2010)
    – Changed webdialog internal name for compatibility
    – Better looking dropdowns under Windows
    – Fixed save filename preselect problem
    – Better code execution and error catching (thanks to Dan Rathbun)
    – Faster file loading for large files
    – Added cookie-based saving of preferences (expires after 365 days)
    – Added changeable user interface
    – Modified some references
  • Version 1.0 (2/3/2010)
    – First release


This editor was originally based on Jim Folz’s Web Console plugin.

In addition to Jim’s original code and whatever I added and modified, this editor uses the jQuery and jQuery UI libraries. Syntax highlighting is provided by the excellent Codemirror. I am also grateful for many comments and suggestions from Dan Rathbun and many others at SCF.

Comments and Reactions