Hi guys, pls I’m pretty new to SketchUp and will like to know what a ruby script is and how to write one?.Thanks.
A script is a plain text file that contains a simple program for automating tasks. You can open a script in a text editor like Notepad (or Notepad++, TextEdit, TextMate, Gedit, etc.). Ruby is the scripting language that SketchUp offers to customize SketchUp, automate modeling tasks or add custom tools.
You should first get familiar with sending commands to SketchUp in the Ruby Console. It is like a conversation (chat with SketchUp).
You can also install the Ruby Console+ extension which makes it easier to learn Ruby.
Check out SketchUp’s developer portal and work through the beginner tutorials.
Thanks, Aerilius will check that out. Very helpful.
If you are brand to to Ruby/programming, have a look at the Getting Started resources over at Ruby’s website:
There’s for instance a “Ruby in 20 minutes” section that guides you through the basics: https://www.ruby-lang.org/en/documentation/quickstart/
Once you have gotten somewhat familiar with the basic concepts of programming, you can look at some of the examples/tutorials we have on our GitHub account. Outlines the basics for a SketchUp extension:
The simplest extension example demonstrate how to create a menu item and a comment that create a cube. It’s heavily commented: https://github.com/SketchUp/sketchup-ruby-api-tutorials/tree/master/tutorials/01_hello_cube
You can have a look at those references, and play in the Ruby Console, (Or @Aerilius’s Ruby Console+) to get yourself familiar with the SketchUp API.
Always keep the Ruby documentation and SketchUp Ruby API documentation handy. (See Dan’s post)