I had thought about doing a blog post on this topic some time ago, but with some persuasion from my friends over at RevitForum.org I decided to finally get to it!
Deciding to learn programming is a big decision and not something to just jump into unless you are willing to put in the time and hard work required to get past the steep learning curve. The benefits to create huge timesaving programs for you and your firm are well worth the effort. I am not a professional programmer; I am a mechanical design engineer by trade so I had to start from scratch with very little programming experience besides LISP scripting. I will outline what worked for me, the steps I took, the resources I used, and the best ways to cut down the learning curve.
STEP 1: Language Selection
There are two main languages one may choose to use vb.NET and C# (C Sharp). Both can do the same exact things, in other words you can create the same exact programs from either language as they are compiled equal to each other in binary format. With that said there are pros and cons to each, lets run down the list:
PROS
Vb.NET
- The syntax (keywords) are written left to right in order similar to normal English
- Very well documented around the web
- Is typically the code language of choice for hobbyist coders
C#
-
This is the language of choice for the Revit API SDK
- Most of the example code provided by Autodesk is written in C#
-
Most professional programmers choose this language
- thus there is more support around the web for it
-
More support in IDE's such as Microsoft's Visual Studio
- There are quick tools to aid you in writing your code
-
Most Revit API bloggers utilize this language
- Thus you will find more working code examples in this language around the web currently
CONS
Vb.NET
- Little Revit API example code
- Less added features in Visual Studio
- Less community support
C#
With the Pros listed you must be thinking "why would anyone choose vb.NET over C# when this is what Autodesk prefers to use for their SDK". Well, I started in vb.NET mainly due to the fact that my co-worker who was aiding in my coding development was fluent in vb.NET and it seemed like a natural fit as it is easier to pick up. BUT, since your main goal is to program for the Revit API, my recommendation is that you learn C# just due to the amount of API examples and support out there is much greater than for vb.NET. Ok now that your language choice is complete let's move to step 2.
STEP 2: Learning the Language
Now to dig in and learn how to code! NOT how to code for the Revit API that is, but only how to code standalone apps to help you understand the language and its syntax. There are a lot of places for reference on the web etc, but I always prefer a book or two or ten! Let's list out some options:
Books – You will want to start at the beginner level coding books.
-
Vb.NET
- Vb 2008 Step by Step – This was the 2nd book I purchased, very good but not as well written as number ii
- VB 2010 in 24 Hours – The first book I purchased, I still refer to it today. Very well written and easily readable.
-
C#
-
General coding books:
Resources
- MSDN Library – This is one of the best places to find data on the .NET framework. Examples are provided in all languages. Note that this site does not like safari browsers….figures Microsoft doesn't like Apple J
- http://www.codeproject.com/ - There are thousands of example solutions up for free download on here. The forums here are great, get help form professional coders who live eat and sleep code.
- http://www.c-sharpcorner.com/ - great site for all c# questions
- http://www.startvbdotnet.com/language/ - Great outline of vb.net and a good reference place for syntax
I like to read the books cover to cover, but you will find a lot of chapters are about interacting with databases etc., not all of this info is relevant as a beginner and can even confuse you when you're starting out. Do the examples, and practice, practice, practice. Consider reading 1 or two books before jumping into the Revit API. While you can start API coding earlier, the more you understand the basics of .NET framework and general software engineering the more comfortable you will be coding Revit Apps.