Translate Page

Main Menu

SketchUp Ruby Code Editor

Description

This code editor allows creating and modifying Ruby scripts within SketchUp. These scripts can be used to create geometry, add functionality or add data within the SketchUp 3D modeling environment.

This editor is an extension of Jim Folz’s excellent Web Console plugin.

I created this version of the editor mainly for two reasons: One is that when I code, I permanently need to look up documentation. To fix this, I added a bunch of reference webpages to a browser in a tab. Also, a dropdown above the editor contains some common code snippets that can be inserted at the current cursor position.

The other reason is that I wanted it to behave a bit more like a real code editor, so I added a bit of jQuery magic to make it look good and have some additional features. While it still isn’t a full-fledged code editor (with syntax highlighting, autocomplete etc.), it is actually quite functional for smaller projects. In the 1.1 version, you can also set your user interface preference (light, dark or blue).

At this point, this editor has the following features:

  • Execute multiline Ruby code directly in SketchUp (from Web Console)
  • Open and save files (from Web Console)
  • Reasonably fast opening of large files
  • Nice and clean user interface (using jQuery UI)
  • Line indentations are preserved when opening files
  • Tab key works as expected in editor (inserts spaces or tab)
  • Dropdown with code snippets inserts snippets at cursor
  • On save, a backup file can be created
  • Text size dropdown selects editor font size
  • Line highlighting in editor
  • Undo button next to run button
  • Reliable editor dialog resizing
  • Tab and accesskey navigation
  • Reference web browser for common reference sites
  • Browser zoom
  • Style changer for user interface

Downloads

SketchUp Ruby Code Editor v.1.1.2 (195.26 KB, downloaded 321 times) - PLEASE NOTE: Download the ZIP file and unzip it into the SketchUp plugin directory (usually at C:\Program Files\Google\SketchUp\Plugins\ in Windows). Then re-start SketchUp and look for the new menu item in the Plugins menu. If you are updating, just overwrite the old version of this plugin.

Screenshots

Main editor window with snippets dropdown shown

Main editor window with dark UI

Browser tab with links shown

Win7-style split-view of editor and SU

Options page (dark UI)

About page

Credits

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

Revision History

  • Version 1.0 (2/3/2010)
    – First release
  • 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.1.1 (2/25/2010):
    – Safari-related fixes (cookies, text insert, removed back button)
  • 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
RATE POST: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, 5.00/5)
Loading ... Loading ...

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

8 Responses to “SketchUp Ruby Code Editor”

  1. John says:

    Great idea!

    To get your sample code to work I had to add "Math." to sin function to prevent the error:
    (eval):9:in ‘initialize’: undefined method ‘sin’ for #<WebConsole:0×6e6d5d8>

  2. Gerrit Hubers says:

    Dan, it (whatever you may call it (not a SU-tool though!)) was mentioned to show up in the Tools menu. Thats why my insignificant remark. Of course I found it where it should be. And later I checked the code where it is send to.
    I can't catch up with you guys but at least that I could figure out.
    Cheers.

  3. Gerrit Hubers says:

    Alexander,

    Hi, I'm Gerrit Hubers / Wo3Dan on the SU forums. Thanks for making this script/editor. Hopefully it's going to help me in getting to know how to write (simple) ruby scripts for SU. I liked Jim's Web Console for it was integrated in SU's environment. For me that's essential for understanding what happens when, when trying/altering snippets. So I'm really excited about this tool!!!
    One verrrrrrry small remark from a simple futur user. Your tool shows up in the 'Plugins' folder in SU, not in the 'Tools' folder.

    Thanks again,
    Gerrit

Leave a Reply