Python and Ruby Scripting Resources and the Sharp Glyph

Do you know very little about scripting and want to get started?
Life_alive
Here are some recommendations on getting started with Python and Ruby from Steven Mycynek of the Revit API development team and Saikat Bhattacharya of Autodesk Consulting.

I am writing this from the most wonderful organic restaurant ever,
life alive in Cambridge, Massachusetts, on my way to the Boston airport to fly back home.

Steven’s Recommendations

Ruby and Python are the two main scripting languages Revit is working with.
If you want to learn them and don’t have any experience, I highly recommend you start here:

These websites give you an interactive Python and Ruby shell right from your web browser; Windows with Internet Explorer, Chrome, or FireFox work best.
There is nothing to install, and there is a built-in tutorial on each site.

Spend a couple hours with each of these websites and decide which language you want to pursue.

Here are some up-front things to consider:

Python

  • Is a few years older than Ruby (1989).
  • Has a slightly larger community on all platforms.
  • Has a theme of “There is one right way to do things.”
  • Supports object-oriented design, but it has a strong “C” heritage and often appeals to people who don’t do a lot of object oriented design.

Ruby

  • Is a few years newer than Python (1995).
  • Is mostly popular greatly because of the “Ruby on Rails” framework.
  • Often encourages more than one way to do something.
  • Has a bit more of an object-oriented focus.

I think it is impossible to say that one is easier than the other, but you might find more Python developers in your everyday life to help with beginner questions.

Once you have decided what you want to do next, here are a few good beginners books:

If you would like to install Python or Ruby instead of using the interactive websites, here are the sources for that:

With regards to IronRuby, I would suggest focusing on the basics of Ruby first and not to worry about integrating with .NET right away.

Start with these.

Python the Hard Way

Saikat Bhattacharya, who meanwhile has moved on from the ADN AEC workgroup to Autodesk Consulting, stumbled over another great free Python learning book that I find amusing and takes you a step deeper into real programming issues,
learnpythonthehardway.org/book.

It has a bit of a stricter tone.
Don’t let it bother you, as the author is just trying to do what is best for the beginner.

I really like this section:

A Warning For The Smarties

<

p style=”color: darkblue”>Sometimes people who already know a programming language will read this book and feel I’m insulting them.
There is nothing in this book that is intended to be interpreted as condescending, insulting, or belittling.
I simply know more about programming than my intended readers.
If you think you are smarter than me then you will feel talked down to and there’s nothing I can do about that because you are not my intended reader.

<

p style=”color: darkblue”>If you are reading this book and flipping out at every third sentence because you feel I’m insulting your intelligence, then I have three points of advice for you:

  1. Stop reading my book. I didn’t write it for you. I wrote it for people who don’t already know everything.
  2. Empty before you fill. You will have a hard time learning from someone with more knowledge if you already know everything.
  3. Go learn Lisp. I hear people who know everything really like Lisp.

<

p style=”color: darkblue”>For everyone else who’s here to learn, just read everything as if I’m smiling and I have a mischievous little twinkle in my eye.

:-)

The Octothorpe

I learned another ‘really important’ thing from Learn Python the Hard Way, on the hash sign #, which it calls ‘octothorpe’:

<

p style=”color: darkblue”>An ‘octothorpe’ is also called a ‘pound’, ‘hash’, ‘mesh’, or any number of names. Pick the one that makes you chill out.

That led me to look at the corresponding Wikipedia entry on the
number sign and
learn more interesting stuff, such as

The Sharp Glyph

<

p style=”color: darkblue”>Resemblance to the glyph used in music notation, U+266F, ♯.
So called in the name of the Microsoft programming languages C# and F#.
However Microsoft says, “It’s not the ‘hash’ (or pound) symbol as most people believe.
It’s actually supposed to be the musical sharp symbol.
However, because the sharp symbol is not present on the standard keyboard, it’s easier to type the hash symbol instead.
The name of the language is, of course, pronounced ‘see sharp’.”
According to the ECMA-334 C# Language Specification, section 6, Acronyms and abbreviations, the name of the language is written “C#” (“LATIN CAPITAL LETTER C (U+0043) followed by the NUMBER SIGN # (U+0023)”) and pronounced “C Sharp”.

 

 

Anyway, I really find the author of Learn Python the Hard Way pretty funny and very instructive :-)

I hope you find these suggestions useful.


Comments

2 responses to “Python and Ruby Scripting Resources and the Sharp Glyph”

  1. Hello Jeremy,
    I have been fiddling with C# programming lately because of my interest in Revit API.
    And having a background in C-style language, I managed to play with the examples that comes with the SDK and come up with a working addin for my company use.
    Personally, I know very well the value this brings to my company that’s why I want to present this to my boss.
    But the thing is, I lack the relevant materials that will supplement my presentation.
    So if its not too much to ask, can you give me a couple of relevant links or perhaps point me to the right resources for the positive outcome that revit api brings to a company implementing Revit customization.
    any data or graphs or perhaps surveys for things like company success stories because they start to customize revit and increase in ROI because of Revit customization… things like that if theres any would greatly help the success of in my upcoming presentation which will eventually lead for my company to sponsor my entry to ADN (hopefully).
    cheers, Ricky

  2. Dear Ricky,
    There is an entire blog dedicated entirely to that subject:
    http://bimapps.typepad.com
    If you need something more concise and compelling than what you find there already, I would suggest that you submit that request as a comment on that blog.
    As far as I can tell, one main intention of BIM Apps is to answer exactly this request.
    I hope that helps.
    Good luck with your add-in development and especially your company politics :-)
    Cheers, Jeremy

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading