Macros vs. Add-Ins – What’s the difference?

There are two different ways to work with the Revit API. In general, the code you write will be the same or almost the same in either case. Developing a macro is easier and simpler, but the trade-off is that you are limited in the development tools you use and how you share the macros with other people.  Developing Add-Ins involves more set-up and some technical mumbo-jumbo to register the add-ins with Revit. A main upside of Add-Ins is that you are better able to distribute them to other people.

Here’s a quick review:

Macros

SharpDevelop, a free and open-source development environment (known as an Integrated Development Environment, or IDE), is included in the Revit install. It is automatically connected to Revit so the process of creating macros is relatively simple. SharpDevelop is OK, but many people would rather use Microsoft Visual Studio. But to develop macros you must use SharpDevelop.

Macros are automatically registered with Revit when you compile your code in SharpDevelop. The macros are listed in the Macro Manager which is the UI that you must use to run them.

The code for your macro is stored in an RVT file if it is a document macro. If you create an application macro the code is stored independently on your computer. For the application macro examples I have been developing for this blog, Revit stores the source at C:\ProgramData\Autodesk\Revit\Macros\2013\Architecture\VstaMacros\AppHookup\BoostYourBIM\Source\BoostYourBIM.

You can share your macros with other people either by sending them the RVT file (if it is a document macro) or sending them the source code (but that will take a bit of effort on their part to create a macro on their install of Revit to generate the same macro.

Add-Ins

Add-Ins are developed externally to Revit, usually using Microsoft Visual Studio, the free version called Visual Studio Express, or some other IDE.

The code for your Add-In gets compiled into a DLL file. An ADDIN file needs to be created so that Revit can discover the DLL. The ADDIN file goes into a place like C:\Users\HP002\AppData\Roaming\Autodesk\revit\Addins\2013. The ADDIN and DLL can be distributed to other users to let them run the command.

Advertisements

3 thoughts on “Macros vs. Add-Ins – What’s the difference?

  1. I noticed that the Add-In runs a little faster than the Macro in some cases with the same code and Visual Express is more stable than SharpDevelop (still don’t like it).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s