
Using Images for Scaling and Geometry Patterns in SketchUp (Ruby Snippet)
See which image I used to scale these blocks?
This post was actually inspired by a question in my 3D 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.
TIP:Want to use this without coding? This script is also in one of the tools of my Scale By Tools extension.
Exploring the Code
As you can see in the code snippet below, this is reasonably straightforward once one figures out the basic geometric behavior. The code...