Ruby Code Editor
This code editor plugin offers an easy-to-use and visually appealing way to write and modify Ruby scripts directly within 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.

Features:

  • 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
  • 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
  • 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

Usage:

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

You can also find this extension on GitHub.

More Info and Help:

http://www.alexschreyer.net/projects/sketchup-ruby-code-editor/

Credits:

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.

9735 users
Size:
608.61 KB
Version:
Ruby Code Editor (4.1); July 18, 2017
Number of Views: 
68368
OS Compatibility: 
Languages: 
Popularity: 
Extensions: 7
I am a Senior Lecturer at the University of Massachusetts and author of the book "Architectural Design with SketchUp". My favorite topics are SketchUp, AEC-CAD/BIM, Wood Engineering, Web Design, and Photography.