Make your life easy: Load SketchUp extensions from a cloud folder with a small Ruby script

Make your life easy: Load SketchUp extensions from a cloud folder with a small Ruby script

Are you using SketchUp Pro on multiple computers? As I mention in Chapter 2, it may make sense to leverage one of the many cloud storage services (that you may already be using) like Dropbox, OneDrive, GDrive, etc. to make your life easier by synchronizing those. In essence, using the approach presented here, you can off-load extensions that you want to have available on both machines onto a shared drive, and then you load them back from the respective computers using the script shown below. Tutorial Video https://www.youtube.com/watch?v=mI6FvENlIno Tutorial Steps Step 1: Designate a folder on your cloud drive First, designate a folder on your cloud-synchronized drive as the Plugins folder. As you can see in my example below, I am using OneDrive (at C:/Users/<username>/OneDrive/SketchUp/Plugins), but you can use any other service, too (e.g. for Dropbox on Windows it would likely be C:/Users/<username>/Dropbox/). Of course, for this to work you need to have a cloud-synchronized local folder, not just an online folder. And that folder...
Read More
Creating Variation in Textures for Rendering (Ruby Snippet)

Creating Variation in Textures for Rendering (Ruby Snippet)

This post follows a theme that I explored in several other of my script examples as well: Copied objects in SketchUp don't appear overly realistic if they represent natural items; their geometry is simply too perfect. This is true for landscape items (trees, shrubs) but also for things like wooden boards (see left side in the image above): On a collection of real boards, the knots would be distributed somewhat randomly, not as shown here. Textures before (left) and after (right) Turns out, we can fix this easily with a few lines of code. Just select textured objects, run the code snippet below, and your textures are randomized enough to look realistic (as can be seen in the right side of the image above). TIP:Want to use this without coding? This script is also in one of the tools of my Random Tools extension. Drag the slider to see the result of this code Let's Explore the Code, Step by Step The following steps reference the...
Read More
Randomized Object Placement on Faces (Ruby Snippet)

Randomized Object Placement on Faces (Ruby Snippet)

At least when it comes to creating realistic-looking vegetation in SketchUp, it is important to be able to randomly place, scale, and rotate objects. Nothing looks worse than a "sterile" copied/pasted row of trees, for example. Of course, this applies to other objects as well, like e.g. a shag carpet or fur. Let's fix this with today's code snippet. Random grass in a randomized landscape Typically, the objects to be placed would come in the form of components (trees, grass, bushes, as in the image above). And those then need to be placed somewhat randomly on one or more faces in your model. A good example for that is a lawn, as I discussed in Chapter 5 in my book. As I mention in Chapter 4, there are of course several extensions available that let you accomplish this task. However, as it turns out, we can re-use two pieces of example code from Chapter 7 and do this with just a few...
Read More
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 The resulting turntable animation 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 purpose needs to be located at the origin). A zoom_extents command then makes sure everything is consistently in the view, independent of how far the viewer is away from the object. As you can see, there are a bunch of parameters that...
Read More
Drop Selection to Ground with Ruby (Snippet)

Drop Selection to Ground with Ruby (Snippet)

Dropping all stones to zero (Model: "Rock for landscape 02" by Intresto from 3DW) 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 z = 0. I'll post a tutorial for that at some later point. Code Snippet Select some objects in SketchUp (groups or components only) and run this script. This collection of small script snippets presents handy little routines that...
Read More