From the Book
In this chapter of Architectural Design with SketchUp, you will create scripted geometry in SketchUp. Often called computational geometry, this is an exciting current topic that allows you to produce 3D shapes and arrangements that are impossible (or at least hard) to create by hand. Scripting in SketchUp also allows you to automatize repetitive tasks or facilitate data exchange with text files.
If you are new to scripting (or coding), then this chapter can serve as a thorough general introduction. You will learn principles that are common to many scripting languages, and you will apply those to creating items in SketchUp’s 3D environment—items that you can even fabricate (using instructions from Chapter 6).
Because the underlying Ruby scripting language is not available in SketchUp’s web or iPad apps, this chapter can only be used with the desktop SketchUp (Pro) version.
Note: This was Chapter 6 in the first edition.
Go beyond the book:
Check out my tutorials on this site in the Scripting category
SketchUp Models In This Chapter
Below are two of the models that you can explore interactively in your browser (click and drag to orbit):
View and download all models from this chapter on the 3D Warehouse.
Links In This Chapter
Updated links will be listed here:
- http://www.alexschreyer.net/projects/sketchup-ruby-code-editor/ – Install this code editor so that you can easily use the script samples in this chapter.
- http://www.7-zip.org/ – 7-Zip
- http://sketchuptips.blogspot.com/2007/08/plugin-webconsolerb.html – WebConsole plugin
- http://sketchucation.com/forums/viewtopic.php?t=28571 – Ruby Console Pro (UPDATED)
- https://developer.sketchup.com/ – SketchUp Ruby API (UPDATED)
- http://www.ruby-lang.org/en/ – Official Ruby site
- http://tryruby.org/ – Try Ruby
- http://ruby-doc.org – Ruby Docs
- http://en.wikibooks.org/wiki/Ruby_Programming – Ruby programming e-book
- http://www.techotopia.com/index.php/Ruby_Essentials – Ruby essentials
- http://www.zenspider.com/ruby/quickref.html – Ruby QuickRef (UPDATED)
- http://www.alexschreyer.net/cad/sketchup-ruby-api-cheatsheet/ – My SketchUp Ruby API cheatsheet
- https://forums.sketchup.com/c/developers – Official SketchUp developers’ group (UPDATED)
- http://sketchucation.com/forums/viewforum.php?f=180 – Developers’ forum on SketchUcation (UPDATED)
http://cfcl.com/twiki/bin/view/SketchUp/Cookbook/WebHome– SketchUp Ruby cookbook (DISCONTINUED)
Download The Script Examples
You can save yourself some typing and download all Ruby scripts from this chapter as a ZIP archive:
Sample Videos From This Chapter
You can access all Chapter 7 videos using the password from the book on Wiley’s companion site: www.wiley.com/go/schreyer2e
All Chapter 7 videos:
- 0701: Fun with coding in SketchUp (for all ages) (included here)
- 0702: Intro to coding with the Ruby Code Editor (included here)
- 0703: Mapping an object onto a shell
- Check out my tutorials on this site in the Scripting category
UP NEXT: Chapter 8 shows how you can use LayOut for documentation.
Discuss This Chapter
Use the discussion area below to add any comments, tips, tricks etc. for this chapter…