Set Up a Turntable animation Video in SketchUp with Ruby (Snippet)

Set Up a Turntable animation Video in SketchUp with Ruby (Snippet)

https://youtu.be/mnAv54zK1DE?autoplay=1&loop=1 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). Every once in a while it's very useful to be able to precisely control the view in SketchUp. One of those cases is when you are creating a turntable animation video of an object (like the one shown above). The snippet below allows you to set that up by creating pages with defined view parameters. First, we need to set the eye (view) height. That is best roughly located at the middle of the object, nine feet in my example. Then we are simply creating as many pages as necessary (in SketchUp proper, those are called "Animation Scenes", of course). I decided to go with four orthogonal views that all point at the object (which for this...
Read More
Drop Selection to Ground with Ruby (Snippet)

Drop Selection to Ground with Ruby (Snippet)

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 simple code snippet takes any objects (groups or components) that you have selected and drops them to the ground (i.e. moves them to z = 0). I find this quite useful sometimes to just make sure that all those objects in my model are actually on the ground plane and not 1/64" above or below it. Just keep in mind that this routine uses the lowest point in an object's bounding box. Select the object to see how that (blue) bounding box looks like before you use the code. Also: This does not work for lines and edges because for those you will need to move their vertices individually to...
Read More
Export Image from SketchUp with Ruby (Snippet)

Export Image from SketchUp with Ruby (Snippet)

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...
Read More
Patterned Panel + Bending Extension = Cool Candle Holder

Patterned Panel + Bending Extension = Cool Candle Holder

Now that the days are getting shorter, it may be a nice home decorating idea to create a decorative candle holder. Having the powers of SketchUp and computational design methods as well as 3D printing at our fingertips, it does, of course, make sense to create something more interesting than just a boring lampshade. This brief example uses the patterned panel exercise from Chapter 7 to create the basic geometry. Of course you can replace the sinusoidal wave pattern easily now with another beautiful function, or you could even have the cutout pattern generated based on colors in an image, which allows you to make it look like a logo, landscape, etc. Since the resulting shape needed to have the pattern cut into a curved surface, there were basically two approaches: 1) create a curved surface and place the geometry onto it by arranging it radially (and then subtracting it), or 2) creating the panels flat and then curving them. Also, this...
Read More
Using images for scaling and geometry patterns in SketchUp

Using images for scaling and geometry patterns in SketchUp

This post was actually inspired by a question in my Basecamp presentation: Could we use images to create or modify geometry in SketchUp? As it turns out, this is actually quite easy since SketchUp version 2018. This year's version of SketchUp includes a new class in Ruby, the ImageRep. Contrary to the regular Image class (which you can use to work with images as entities in SketchUp), the ImageRep class goes further and allows you to look at images on a pixel by pixel basis. This is basically what we need to be able to read pixel color values and then use those to create or modify geometry. As you can see in the code snippet below, this is reasonably straightforward once one figures out the basic geometric behavior. The code even stretches the image by the (x and y) dimensions of the selected geometry. One part that needed to be resolved was that color information in an image contains red, green, and...
Read More