Application functions provide access to documents, objects, and other application data and settings. All Application and UIApplication functions are identified and defined in the following sections.
The class represents the Autodesk Revit Application, providing access to documents, options and other application wide data and settings.
Application properties include VersionBuild, VersionNumber and VersionName. These can be used to provide add-in behavior based on the release and build of Revit, as shown in How to use Application properties to enforce a correct version for your add-in.
The Application class provides methods to create the following types of documents:
The OpenDocumentFile() method can be used to open any of these document types.
All open documents can be retrieved using the Documents property.
For more details, see Document and Management.
Properties such as UserName and methods such as GetRevitServerNetworkHosts() provide read-only access to this session specific information.
Revit uses one shared parameter file at a time. The Application.OpenSharedParameterFile() method accesses the shared parameter file whose path is set in the SharedParametersFilename property. For more details, see Shared Parameter.
The Application class exposes document and application events such as document open and save. Subscribing to these events notifies the application when the events are enabled and acts accordingly. For more details, see Access to Revit Event in the Add-In Integration section.
The FailureDefinitionRegistry, which contains all registered FailureDefinitions is available from the static GetFailureDefinitionRegistry() method. The static method RegisterFailuresProcessor() can be used to register a custom IFailuresProcessor. For more information on posting and handling failures, see Failure Posting and Handling.
This class represents an active session of the Autodesk Revit user interface, providing access to UI customization methods, events, and the active document.
The UIApplication provides access to the active document using the UIActiveDocument property. Additionally, a Revit document may be opened using the overloaded OpenAndActivateDocument() method. The document will be opened with the default view active. This method may not be called inside a transaction and may only be invoked during an event when no active document is open yet in Revit and the event is not nested inside another event.
Use the UIApplication object to add new ribbon panels and controls to Revit.
For more details, see Ribbon Panel and Controls in the Add-In Integration section.
The UIApplication class exposes UI related events such as when a dialog box is displayed. Subscribing to these events notifies the application when the events are enabled and acts accordingly. For more details, see Access to Revit Event in the Add-In Integration section.