The Revit API now offers the ability to register API applications via a .addin manifest file.
Manifest files will be read automatically by Revit when they are places in one of two locations on a user’s system:
- In a non-user specific location in “application data”
- For Windows XP – C:\Documents and Settings\All Users\Application Data\Autodesk\Revit\Addins\2011\
- For Vista/Windows 7 – C:\ProgramData\Autodesk\Revit\Addins\2011\
- For Windows XP – C:\Documents and Settings\<user>\Application Data\Autodesk\Revit\Addins\2011\
- For Vista/Windows 7 – C:\Users\<user>\AppData\Roaming\Autodesk\Revit\Addins\2011\
- In a user specific location in “application data”
All files named .addin in these locations will be read and processed by Revit during startup.
A basic file adding one ExternalCommand looks like this:
<?xml version=”1.0″ encoding=”utf-8″ standalone=”no”?>
<RevitAddIns>
<AddIn Type=”Command”>
<Assembly>c:\MyProgram\MyProgram.dll</Assembly>
<AddInId>76eb700a-2c85-4888-a78d-31429ecae9ed</AddInId>
<FullClassName>Revit.Samples.SampleCommand</FullClassName>
<Text>Sample command</Text>
<VisibilityMode>NotVisibleInFamily</VisibilityMode>
<VisibilityMode>NotVisibleInMEP</VisibilityMode>
<AvailabilityClassName>Revit.Samples.SampleAccessibilityCheck</AvailabilityClassName>
<LongDescription>
<p>This is the long description for my command.</p>
</p/>
<p>This is another descriptive paragraph, with notes about how to use the command properly.</p>
</LongDescription>
<TooltipImage>c:\MyProgram\Autodesk.jpg</TooltipImage>
<LargeImage>c:\MyProgram\MyProgramIcon.png</LargeImage>
</AddIn>
</RevitAddIns>
A basic file adding one ExternalApplication looks like this:
<?xml version=”1.0″ encoding=”utf-8″ standalone=”no”?>
<RevitAddIns>
<AddIn Type=”Application”>
<Name>SampleApplication</Name>
<Assembly>c:\MyProgram\MyProgram.dll</Assembly>
<AddInId>604B1052-F742-4951-8576-C261D1993107</AddInId>
<FullClassName>Revit.Samples.SampleApplication</FullClassName>
</AddIn>
</RevitAddIns>
Multiple AddIn elements may be provided in a single manifest file.
The new mechanism currently offers the following XML tags:
| Tag |
Description |
| Assembly |
The full path to the add-in assembly file. Required for all ExternalCommands and ExternalApplications. |
| FullClassName |
The full name of the class in the assembly file which implements IExternalCommand or IExternalApplication. Required for all ExternalCommands and ExternalApplications. |
| ClientId |
A GUID which represents the id of this particular application. ClientIds must be unique for a given session of Revit. Autodesk recommends you generate a unique GUID for each registered application or command. Required for all ExternalCommands and ExternalApplications. The property UIApplication.ActiveAddInId provides programmatic access to this value, if required. |
| Name |
The name of application. Required; for ExternalApplications only. |
| Text |
The name of the button. Optional; use this tag for ExternalCommands only. The default is “External Tool”. |
| Description |
Short description of the command, will be used as the button tooltip. Optional; use this tag for ExternalCommands only. The default is a tooltip with just the command text. |
| VisibilityMode |
Provides the ability to specify if the command is visible in project documents, family documents, or no document at all. Also provides the ability to specify the discipline(s) where the command should be visible. Multiple values may be set for this option. Optional; use this tag for ExternalCommands only. The default is to display the command in all modes and disciplines, including when there is no active document. Previously written external commands which need to run against the active document should either be modified to ensure that the code deals with invocation of the command when there is no active document, or apply the NotVisibleWhenNoActiveDocument mode. |
| AvailabilityClassName |
The full name of the class in the assembly file which implemented IExternalCommandAvailability. This class allows the command button to be selectively grayed out depending on context. Optional; use this tag for ExternalCommands only. The default is a command that is available whenever it is visible. |
| LargeImage |
The path to the icon to use for the button in the External Tools pulldown menu. The icon should be 32 x 32 pixels for best results. Optional; use this tag for ExternalCommands only. The default is to show a button without an icon. |
| LongDescription |
Long description of the command, will be used as part of the button’s extended tooltip. This tooltip is shown when the mouse hovers over the command for a long amount of time. You can split the text of this option into multiple paragraphs by placing <p> tags around each paragraph. Optional; use this tag for ExternalCommands only. If neither of this property and TooltipImage are supplied, the button will not have an extended tooltip. |
| TooltipImage |
The path to an image file to show as a part of the button extended tooltip, shown when the mouse hovers over the command for a longer amount of time. Optional; use this tag for ExternalCommands only. If neither of this property and TooltipImage are supplied, the button will not have an extended tooltip. |
| LanguageType |
Localization setting for Text, Description, LargeImage, LongDescription, and TooltipImage of external tools buttons. Revit will load the resource values from the specified language resource dll. The value can be one of the eleven languages supported by Revit. If no LanguageType is specified, the language resource which the current session of Revit is using will be automatically loaded. For more details see the section on Localization. |
The Revit.ini registration mechanism remains in place for the 2011 release but will be removed in the future. The Revit.ini mechanism does not offer any of the new capabilities listed above. In addition, because Dynamic Model Update registration requires a valid AddInId, updaters may not be registered from applications declared in Revit.ini.