As much as I enjoy using Revit, sometimes it can be a real chore. Let’s face it, there are certain things we need to do on a daily basis that are super tedious. Creating sheets, changing parameters, loading linked files – all these tasks eat up a lot of time, and as we all know, time is a precious resource. Those minutes or hours spent clicking the mouse could be better utilized on higher leverage activities like improving the design or getting home for dinner.
Plus, the computer is much better at doing these tasks than we are. It’s faster and more accurate. I start to zone out after only five minutes of doing the same thing over and over. This leads to errors and time wasted redoing work. Ugh. . .
Fortunately, through the magic of automation, we can harness the power of the computer to do this tedious work for us.
Revit has been around for more than fifteen years. It’s a mature product. As I’m sure you’ve noticed, the rate of new feature development has slowed considerably. If you want Revit to do something specific, to make it work the way you work, you’re most likely going to need to do it yourself.
Learning to automate Revit is a bit like working on your car or fixing up your house. You’re going to look under the hood, get your hands dirty, and learn how things work. You already know how to use the software. Now it’s time to take things to the next level and really get productive.
Fortunately, it’s not too hard to get started. There are three options for automating Revit. You can visually program Revit using Dynamo. You can write custom add-ins with Visual Studio. Or, my favorite, you can write macros using Revit’s built-in macro editor.
Here’s a description of each method with some pros, cons, and additional resources to get you going.
Dynamo is a visual programming environment for Revit. It’s open-source software which you can download for free. Of all three methods, Dynamo is the new kid on the block and has generated considerable interest and attention.
In Dynamo, you create programs, or “graphs”, by connecting code blocks called “nodes”. Each node performs a specific function and has inputs and output. The process is very visual. Nodes are connected with lines that determine the sequence of events. One of the benefits to Dynamo is that you don’t need to know how to program, since the nodes contain all of the programming logic.
On the downside, Dynamo graphs can get really complicated. The more nodes you use, the more connecting lines you have in the graph. After a while, it looks like a lot of spaghetti on the screen. Also, you can’t create an interface for a Dynamo graph, so anyone else who wants to use your graph needs to have Dynamo installed and a working knowledge of the software. Another downside is that Dynamo graphs aren’t compiled so they tend to run slower than the other methods. Lastly, Dynamo is still evolving so it’s not fully mature. . . yet. There are things you can do with add-ins or macros that you can’t do in Dynamo without a little programming know-how.
That said, Dynamo is an exciting option for automating Revit. New nodes are being created daily and there’s an active community around the platform. Want to try Dynamo? Check out the Dynamo Primer or watch this video tutorial I put together on linking Excel to Revit using Dynamo.
Add-ins are the most powerful method for automating Revit but they’re also the most difficult for beginners. Add-ins are installed on the local computer and are accessible from the Revit Add-ins ribbon or a custom Ribbon. Add-ins are written in code (either C# or VB.Net) using an external programming environment like Microsoft Visual Studio. Once you write the add-in, you compile the code as a .dll file and load it into Revit using a XML manifest file.
Since add-ins are installed like software, they’re easier to distribute in an office environment. You just need to install the .dll and the XML file in the proper location and every user of that computer can access the add-in. In addition, you can fully customize the way the add-in appears on the ribbon. Jeremy Tammik’s blog, The Building Coder, is a great resource if you’re interested in writing add-ins.
One of the difficulties with creating add-ins is the learning curve. You need to learn the Revit API. You need to learn how to use Visual Studio. You need to learn how to connect Visual Studio to Revit. Additionally, you need to learn how to create controls in the Revit interface. It takes some time to get comfortable with each of these. That said, add-ins give you the greatest control over Revit and provide the most seamless interface with the software. Plus, if you create really useful add-ins, you can sell them on the Autodesk App Store.
Macros are my favorite way to automate Revit. They don’t require any additional software to create (like add-ins) but they still give you full access to the Revit API. Macros are written in code using SharpDevelop, Revit’s built-in programming environment. The macro code is saved within an RVT file, not in external files like add-ins. To run the macro, you must first load the RVT file. Macros are compiled so they run fast. You can also create dialog boxes for your macros, so they’re easy for non-programmers to use.
Here are three more reasons why I like macros:
- It’s easy to get started. You don’t need to install any additional software like you do for Dynamo or add-ins.
- You can convert macros into add-ins. Since the code is the same, it’s easier and faster to create the macro first then convert it to an add-in.
- Once you know how to write macros, you can leverage your knowledge of the Revit API to create custom nodes in Dynamo.
Want to start writing your own macros? Here’s the first lesson from my Mastering Revit Macro course. It reviews the basics of creating Revit macros and takes you step-by-step through the process of creating some simple macros. Give it a try!
One downside with macros is that they’re not as easy to distribute as add-ins. If someone wants to use a macro, they have to open the RVT file first. Once the file is open, you can run all the macros embedded in the file. This makes sharing macros more difficult in an office environment. Fortunately, it’s very easy to convert macros to add-ins.
Learning one of these Revit automation methods will drastically improve your efficiency. A well-written graph, macro or add-in can complete a tedious task with the click of a button, and save you hours in the process. As your skills grow, so will your ability to do the seemingly impossible. Automation takes time and patience but it’s a rewarding endeavor. Don’t be intimidated. Start small, be systematic, and develop your skills. Soon you’ll be on your way to automation mastery!
Want to learn how to automate Revit?
Check out my Mastering Revit Macros course. It will take you from complete beginner to Revit programming master in 8 real-world lessons.