Thursday, March 25, 2010

What’s New in the Revit 2011 API: New Deployment Methods

(Part of our Revit API 2011 Series)
Deploying commands and applications in Revit up until now has required a mental visit back to the 90’s… You had to create or edit sections within the Revit.INI file – keywords and values (and ugly ones at that). And developing installers which would programmatically add and remove things? Ugh!

Autodesk has heard and finally answered the call on this issue – new in 2011 are XML-based “add-in” files. These new files (typically one for each program) also address some of the issues with permissions – particularly in Vista and Windows 7:

The locations are:

  • For “All Users”:
    • Windows XP: C:\Documents and Settings\All Users\Application Data\Autodesk\Revit\Addins\2011\
    • Windows Vista/Windows 7: C:\ProgramData\Autodesk\Revit\Addins\2011\
  • For “User-Specific”:
    • Windows XP: C:\Documents and Settings\<user>\Application Data\Autodesk\Revit\Addins\2011\
    • Windows Vista/Windows 7: C:\Users\<user>\AppData\Roaming\Autodesk\Revit\Addins\2011\

For .NET programmers, I would recommend using the Environment.GetFolder() method, where you can specify:

  • All Users: Environment.SpecialFolder.CommonApplicationData
  • Current User: Environment.SpecialFolder.ApplicationData

A basic Command sample might look like:

<?xml version="1.0" encoding="utf-16" standalone="no"?>
<AddIn Type="Command">
<Text>Room Renumber</Text>

I’ll write more about some of the capabilities implied here – but as you can see it represents a big step forward versus the REVIT.INI file (which still works).

More Deployment Help Still… For Installers.

As mentioned above – writing installers for Revit in the olden-days was no picnic. While it’s no picnic in 2011, beyond the new file format, Autodesk has also provided an all-new redistributable DLL – specifically to help developers do installations in .NET.

The “RevitAddInUtility.DLL” can:

  1. Provide you information about which versions of Revit 2011 are installed (no much reverse engineering 6+ uninstall registry keys!).
  2. Get all existing addins, and manifest.

All in all, there are a variety of new features, capabilities and tools which bring more power and professionalism to Revit AddIn deployment in 2011.

No comments: