In this chapter, 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 great 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).
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)
- http://www.sketchup.com/intl/en/developer/ – 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/Languages/Ruby/QuickRef.html – Ruby QuickRef
- http://www.alexschreyer.net/cad/sketchup-ruby-api-cheatsheet/ – My SketchUp Ruby API cheatsheet
- https://groups.google.com/forum/#!forum/google-sketchup-developers – Official SketchUp developers’ group
- 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
Download The Script Examples
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
Comment On This Chapter
Use the form below to add any comments, tips, tricks etc. for this chapter…