One of my children has asked how to learn to create plugins for SketchUp and LayOut. I thought I would ask here, because I really don’t know the best way to get started. He has taken some of the CodeAcademy courses (JS, CSS, etc.), but overall is at a basic level of programming understanding. Also, since he would be getting started from scratch, should he learn ruby or C?
It’s relatively easy to write a plugin in Ruby … I would have him learn it first (next?). As a start, I would take a look at this entry point to creating plugins: http://www.sketchup.com/intl/en/developer/docs/new_to_ruby
In addition, there’s a sub-forum of this one where he can ask questions (or you can do so as his proxy if he is underage): http://forums.sketchup.com/c/developers/ruby-api
I think you will find a lot of encouragement here to help him get started. One caveat … I’ve noticed that a considerable number of people jump into SketchUp and/or Ruby with an elaborate project in mind. I would recommend following the “Hello, World!” type of examples and reading the instructions until he’s comfortable with the code and how it works within SketchUp first.
@jimhami42, thanks for the info. With ruby as the recommended starting point, would you suggest just learning ruby as he goes along with the examples, or starting with a more generic ruby course then applying it to SketchUp?
Start with Ruby - for sure. One thing is that is much easier to get started and produce results. Another key point is that it’s the only API at the moment that works within SketchUp itself. The C API only works for reading and writing SKP files in other applications.
I wouldn’t be bad to do some sessions of “plain” Ruby first - to become familiar with the language and general programming experience. There are plenty of getting started tutorials (even interactive ones) for Ruby.
The reason I recommend this is that every API and framework or library adds another complexity to the learning. And if you are very new to programming diving directly into an API/framework might make it harder. I’d argue it’s beneficial to learn the basic of a language first so you learn what the foundation of what the API/framework is built on.
Then start with some simple SketchUp scripts such as adding entities, traversing entities etc.
I wish we had better, up to date, examples for SketchUp Ruby API - but at the moment, alas. This is something we are in the process of improving. I’ll be keeping an eye on this thread to hear what people would think would be good as starter chapters. We have a pretty clear idea already - but always nice to hear additional feedback.
If he wants to write a SketchUp plugin, I would recommend following the SketchUp documentation. As a parallel learning experience, I would also recommend reading the Ruby documentation for each Ruby command he encounters along the way. The SketchUp interface to Ruby is presented as a class library that ultimately inherits everything from Ruby, so understanding the SketchUp class library is fundamental to writing progressively complicated plugins.
The SketchUp docs are here: http://www.sketchup.com/intl/en/developer/docs/index
There are several repositories of Ruby docs … this one is user-friendly: https://www.ruby-lang.org/en/documentation/
@tt_su, how did I not know you were on the SU team? So are you looking to make just updated examples for the documentation, or something more like the Skill Builders? If I have a vote, I think some plugin writing skill builders would be fantastic, right after dynamic component skill builders.
Thanks for the input, I think I’ll let him have at the CodeAcademy Ruby course when he finished the Lynda Detailing for Architecture course.
when looking at Ruby Courses, avoid the Rails orientated ones as they will really muddy the waters…
We’re playing around with different ideas. I’d be a big project - one that’d ideally be continuously running. But we got some initial work to catch up and get the old examples up to date. I hope it can set the foundation that even the community can contribute.