The resulting image
The resulting image

This collection of small script snippets presents handy little routines that are usually too small to put into a proper extension. Use them with the Ruby Code Editor (just paste the code and hit “run”) or make them more permanent as a menu item (see Appendix D in my book).

The following is a handy little Ruby tool if you frequently need to export the current view as an image in SketchUp. It basically allows you to pre-set all of the export parameters (including an export location) and keeps all of those consistent. Of course, this is not too hard with SketchUp itself (because it remembers the last used location and image parameters), but this script allows you to keep those parameters consistent even if SketchUp “forgets” them occasionally (i.e. after you work with a file in a different location).

I use this script mainly when I need to create consistent images from many files, on which I work over an extended period of time. For that purpose, I have it set up as a menu item.

In the example below, the image is exported as a JPG (just change jpg to png if you prefer that file format) at a size of 3000 px (with a 16:9 aspect ratio). It also exports the file with a timestamp as filename right to your desktop, so you don’t need to worry about accidentally overwriting it.

By the way: This is a great routine for exporting square pictures for social media. Just set both sizes to the same values and you get a 1:1 aspect ratio.

The second maintenance release of SketchUp 2019 introduced a new parameter, the scale_factor, which you can pre-set here as well. It controls line-thickness and text appearance in these exports. For my purpose, a scale factor of two looked most appropriate.

Code Snippet

Reference

Links & Ads

Comments