19.12.2016 Views

Architectural_Design_with_SketchUp

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6 Creating Geometry Using Ruby Scripting<br />

the max method ([angle, 0.2].max), which looks for the largest value in an array. Finally, we<br />

apply the transformation <strong>with</strong> a doubled value in the z direction, which creates the ellipses.<br />

Figure 6.26: Solar-oriented opening placement<br />

What Else Is Possible <strong>with</strong> This?<br />

As the preceding examples demonstrated, you can create interesting and intriguing geometry<br />

using scripting in <strong>SketchUp</strong>. The combination of manual modeling and Ruby scripting is a very<br />

efficient and effective approach to get results fast. If this was your introduction to computational<br />

geometry, then feel free to explore further. Start by modifying the code examples and<br />

see where this takes you. It is also a good idea to browse the Ruby API documentation for<br />

methods that could be of value for your design tasks. Here are some ideas:<br />

NN<br />

NN<br />

NN<br />

NN<br />

NN<br />

NN<br />

NN<br />

NN<br />

Insert images using the Image object.<br />

Influence the current view using the Camera object.<br />

Geo-locate your model and add geometry using the LatLong methods.<br />

Modify the layers in your model using the methods of the Layers collection.<br />

Add view tabs to your model using the Pages collection’s methods.<br />

Add an attribute (a text-based parameter) to an object (e.g., a component) and read it out<br />

to a text file. Relevant methods are: model.set_attribute and model.get_attribute.<br />

Add a menu item to <strong>SketchUp</strong> and assign your code to it. Relevant methods are: menu.<br />

add_item and menu.add_submenu.<br />

Create a WebDialog and display some HTML pages in it. You can even make Ruby interact<br />

<strong>with</strong> a WebDialog’s content or JavaScript.<br />

If you decide that Ruby scripting is for you, then you might want to look at some of the<br />

web links mentioned previously and even explore plugin development. If you created a solution<br />

to a problem using Ruby code, then it likely will be useful for someone else, too. Packaging<br />

code as a plugin requires only a few more lines of code and is a great way to share your work.<br />

273

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!