I have recently started my adventure with Revit API.
Main reason – Revit sucks*.
My main question was:
How much I can improve Revit by learning programming in it?
I’m not an expert yet like Jeremy Tammik but I can answer to this question like this: You can do only as much as developers of Revit API allows you to do. Unfortunately they won’t allow you to change Revit core functionality and introduce new features or objects. (It’s not Sketchup 😉 )
API allows an access to the same commands which are used during normal operation of Revit but still not to all of them. API is improved with every new Revit edition and then new commands are made available.
Learning programming with API can allow you to automate tedious tasks, can allow you to build visual interface to commands (i.e Dynamo is one of them) you can save sequences of these commands as Revit Macros or Add-ins and what most important you can join these commands in thousands of different ways.
“Any step that cannot be solved through the user interface can almost certainly not be automated either.” Jeremy Tammik
So where to start?
I gathered below the most important links which should answer your questions. Read them. Additionally I will try to help.
First you will need to decide which programming language you should start to learn. It’s not an easy answer. There are 4 of them:
- C# (sharp)
There is plenty of Macros in C# and VB.Net in the Internet.
This is a huge advantage for these languages. Vast number of commands and a complexity of relations between them make it nearly impossible to learn programming without examples.
I talked with some IT friends and they advices me to learn Python as the most friendly language still with many resources.
VB.Net is little more friendly then C#.
Ruby is the less popular. I didn’t consider to learn it.
And then came the reality. I planed to learn Python but when I encountered a problem in my work I could only find a similar Macro in VB.Net. I decided not to translate it to Python (which I didn’t know too well) but only to slightly amend it to my particular problem. This way I end up amending many Macros and learning VB.Net (and a little C#)
Some time passed and the Dynamo which is based on Python got a lot of improvements and become more stable then before. Increase in implementation of API commands made it really functional.
Interface allows to easily build command structures and amend relations between then. Code Blocks of Python code or the whole Nodes can be used regardless of the predefined Dynamo objects.
I would advice everyone now to learn programming in Dynamo using Python but at the same time understanding of C# and VB.Net may be very useful for solving complex problems. At some point it may also be useful to convert code to Add-in and make a desired functionality a permanent element of the Revit user interface.
Additional very useful tools:
- Revit Lookup – This tool allows to investigate how Revit is build, check what parameters have objects and what is the relation between them.
How to install Revit Lookup:
- API help file – RevitAPI.chm – This a library of all the commands available in the current Revit API version along with some examples. If you can’t find a command in there it doesn’t exist.
RevitAPI.chm is a part of Revit SDK which can be downloaded from the Revit Developer Center.
Additional very useful links:
Jeremy Tammik introduction to Revit API:
The Building Coder webpage by Jeremy Tammik
Michael Kilkelly introdution to Revit API:
ArchSmarter webpage by Michael Kilkelly
Boost Your BIM webpage.
PDF about Scripting with RevitPythonShell:
Another link with PFD about:
Scripting Autodesk Revit with RevitPythonShell
Link to download Revit Python Shell:
Python Macro template:
What’s the difference between macro and Add-in:
http://help.autodesk.com/ – There is a part devoted to developers like you.
API – Application Program Interface
SDK – Software Development Kit
* Still Revit is the best BIM software I know.
Good luck and have fun.