First, a Story
Look up!, at the image above this introduction. The snippet of code captured in that image very closely approximates some of the first lines of Ruby that I ever wrote. I had spent a few hours learning some basic ruby syntax, then I dove into the SketchUp Ruby API with the express purpose of being able to pushpull more than one face at a time - a task repeated so regularly in the City Planning office I was working at where I created model after model of countless cities across the country. I couldn't believe how amazing it was that I could transform a task that can be so time consuming in SketchUp into a few simple lines of code that execute instantly. I saved myself days of double-clicking, pushpull, carpal tunnel laden time. NO, I saved my company days of time. What?! Give that man a raise!
Ok, no such raise came my way. But I did stumble on what has become a passion of mine and so many others - the SketchUp Ruby API. And if you're coming to this page and reading this for the first time, there is a decent chance that you are also on the verge of diving into the SketchUp Ruby API. So lets get started!
What is the SketchUp Ruby API
SketchUp is software that you can use to create 3D models of anything you like. Ruby is a super-powerful plain text programming language and an API an Application Programming Interface (API). Cool, but what does that mean. It just means that you can use the Ruby language to extend SketchUp to do more than it does out of the box. In my example, I wrote myself a quick new tool that gave SketchUp the ability to pushpull hundreds of thousands of faces instantly. Now let's see what you can imagine and add to SketchUp.
Where Should I Begin?
Arguably, I should have lead off with this information. Oh well, too late!
Take me to the Ruby API Docs - If you are familiar with API's, SketchUp, Ruby, etc and just need to find the Ruby API documentation, then click that link! Also, there is a link to it on the right side of this page that says "Check out the latest Ruby API". The API docs have all the documentation that regular consumers of API's need to get up and running quickly with our Ruby API.
I need help getting started - Fortunately for you, we have just the thing. In the Chapter Menu index on the upper right side of the page, you can find a section called "Getting Started". Go there! You will be taken to a series of basic lessons to help API beginners. These Getting Started lessons try hard to break everything down to simple terms, while being highly informative for just about anyone trying to get up and going as quickly as possible.
In Depth Examples - You should also review the section with Example Extensions. There we have example scripts that go well beyond the basics. We show how to package your extension for distribution to others, show many examples of best practices, and more. Once you get oriented and are considering sharing extensions, you'll want to get familiar with the examples in our Example Extensions section.
Thanks for coming and have fun!Chris Fullmer and the entire SketchUp Extensibility Team