Creating Variation in Texture Copies (Snippet)

Creating Variation in Texture Copies (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. 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). 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 code snippet shown below. Select...
Read More
Randomized object placement on faces (Snippet)

Randomized object placement on faces (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). 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. 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...
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 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