What is needed to script?
-
One area of sketchup which i have not gotten much into is the ruby scripting. While i do use various scripts for my models, like the mirror and roof script, i have not tried to make any scripts myself. Would someone be able to tell me what programming language or coding that should learned to become able to create my own scripts for sketchup? There are some ideas that are floating in my head, and would like to see them become reality one of these days.
Thanks.
-
@sk.lion said:
One area of sketchup which i have not gotten much into is the ruby scripting. While i do use various scripts for my models, like the mirror and roof script, i have not tried to make any scripts myself. Would someone be able to tell me what programming language or coding that should learned to become able to create my own scripts for sketchup? There are some ideas that are floating in my head, and would like to see them become reality one of these days.
Thanks.
SKlion,
I have moved this thread to the Ruby Discussion forum. It was originally posted in the Ruby Scripting section of the How to Forum.
As far as software you need SketchUp, and a text editor; even the most basic is enough to get started with: notepad.exe, edit.com (MS DOS).
SketchUp scripts are written in the Ruby language. There's actually a lot of information on learning Ruby online.
If you want some instant gratification, try this:
- open your text editor of choice.
- Enter the following code:
require "sketchup.rb" def myHello UI.messagebox("Hello, SketchUp") end UI.menu("Plugins").add_item("Hello!") { myHello }
That's it. Save the file as hello.rb and move it into your Plugins folder. Now you could close and restart SketchUp, but that gets tedious after awhile. Open the Ruby Console window, and type:
load "hello.rb"
This will load the file and execute it, giving you a menu item named Hello! If you makchanges tot he script you need to load it again so SketchUp knows about the changes.
Next you'll want to start reading the API documentation, and also look at other plugins.
And of course, come back here and ask questions.
Note to the other scripters, I think it's a good experience to see what happens to the Plugins menu when you load the script again - I left it out on purpose.
-
Thanks, i think there is still lots of room to grow in scripting, just wanted to learn a new trick
-
Useful link for the more advanced.
http://notepad-plus.sourceforge.net/uk/site.htm
Advertisement