Application
Represents the Autodesk Revit Application, providing access to documents, options and other application wide data and settings.
Inheritance Hierarchy
System.Object
Autodesk.Revit.ApplicationServices.Application
Autodesk.Revit.DB.Macros.ApplicationEntryPoint
Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class Application : IDisposable
The Application type exposes the following members.
Properties
Name
Description
Public Property
ActiveAddInId
Retrieves the Id of the currently running external application.
Public Property
AllowNavigationDuringRedraw
Checks whether or not the navigation during redraw is enabled, and enable or disable it.
Public Property
AllUsersAddinsLocation
The folder location for .addin files for all users.
Public Property
AngleTolerance
Angle tolerance.
Public Property
BackgroundColor
The background color to use for model views in this session.
Public Property
Code Example
Cities
Returns a set of all the known city locations within Revit.
Public Property
Create
Provides an object that can be used to create new instances of Autodesk Revit API objects.
Public Property
CurrentRevitServerAccelerator
Current Revit Server accelerator.
Public Property
CurrentUserAddinsLocation
The folder location for .addin files for the current user.
Public Property
CurrentUsersAddinsDataFolderPath
Path to AddinsData folder for the current user.
Public Property
CurrentUsersDataFolderPath
Path to data folder for the current user.
Public Property
DefaultIFCProjectTemplate
Full path to the default template file for new IFC project documents. It may be empty, in which case the DefaultProjectTemplate should be used.
Public Property
DefaultProjectTemplate
Full path to the default template file for new project documents.
Public Property
DefaultViewDiscipline
The view discipline that will be applied to new views by default.
Public Property
Documents
Returns a set of documents within Revit.
Public Property
ExportIFCCategoryTable
Full path to the file that defines Revit category to IFC entity mappings for IFC export.
Public Property
FamilyTemplatePath
Default path for family template files.
Public Property
ImportIFCCategoryTable
Full path to the file that defines IFC entity to Revit category mappings for IFC import.
Public Property
IsArchitectureEnabled
Checks whether or not the architecture discipline is enabled, and enable or disable it.
Public Property
IsElectricalAnalysisEnabled
Checks whether or not electrical analysis is enabled, and enable or disable it.
Public Property
IsElectricalEnabled
Checks whether or not the electrical discipline is enabled, and enable or disable it.
Public Property
IsEnergyAnalysisEnabled
Checks whether or not energy analysis is enabled, and enable or disable it.
Public Property
IsInfrastructureEnabled
Checks whether or not infrastructure discipline is enabled, and enable or disable it.
Public Property
Static Member
IsLoggedIn
Checks if the user is logged in from this session to their Autodesk account.
Public Property
IsMassingEnabled
Checks whether or not the massing and site tools are enabled, and enable or disable them.
Public Property
IsMechanicalAnalysisEnabled
Checks whether or not mechanical analysis is enabled, and enable or disable it.
Public Property
IsMechanicalEnabled
Checks whether or not the mechanical discipline is enabled, and enable or disable it.
Public Property
IsPipingAnalysisEnabled
Checks whether or not piping analysis is enabled, and enable or disable it.
Public Property
IsPipingEnabled
Checks whether or not the piping discipline is enabled, and enable or disable it.
Public Property
IsRouteAnalysisEnabled
Checks whether or not route analysis is enabled, and enable or disable it.
Public Property
IsStructuralAnalysisEnabled
Checks whether or not the structural analysis is enabled, and enable or disable it.
Public Property
IsStructureEnabled
Checks whether or not the structure discipline is enabled, and enable or disable it.
Public Property
IsSystemsEnabled
Checks whether or not any systems disciplines (mechanical, electrical, or piping) are enabled.
Public Property
IsValidObject
Specifies whether the .NET object represents a valid Revit entity.
Public Property
Language
The language used in the current session of Revit.
Public Property
LoginUserId
The user id of the user currently logged in. The user id will be empty if the user is not logged in.
Public Property
Static Member
MinimumThickness
The minimum thickness allowed in Revit for a variety of geometric constructs. These include blends, extrusions, and wall layers.
Public Property
PointCloudsRootPath
Root path for point cloud files.
Public Property
Product
The product type for the current session of Revit.
Public Property
RecordingJournalFilename
Retrieve the name of the journal file the Revit is currently recording to.
Public Property
SharedParametersFilename
Contains the fully qualified path to a shared parameters file.
Public Property
ShortCurveTolerance
The enforced minimum length for any curve created by Revit.
Public Property
ShowGraphicalOpenEndsAreaBasedLoadBoundaryDisconnects
Whether or not to show the graphical open ends for Area Based Load Boundary disconnects.
Public Property
ShowGraphicalWarningCableTrayConduitDisconnects
Whether or not to show the graphical warnings for CTC disconnects.
Public Property
ShowGraphicalWarningDuctDisconnects
Whether or not to show the graphical warnings for duct disconnects.
Public Property
ShowGraphicalWarningElectricalDisconnects
Whether or not to show the graphical warnings for Electrical disconnects.
Public Property
ShowGraphicalWarningHangerDisconnects
Whether or not to show the graphical warnings for Fabrication Hanger disconnects.
Public Property
ShowGraphicalWarningPipeDisconnects
Whether or not to show the graphical warnings for Pipe disconnects.
Public Property
SubVersionNumber
The minor version number of Revit
Public Property
SystemsAnalysisWorkfilesRootPath
Root path for systems analysis workfiles
Public Property
Username
Gets the user name for the current Revit session.
Public Property
VersionBuild
Returns the internal build number of the Autodesk Revit application.
Public Property
VersionName
Returns the name of the Revit application.
Public Property
VersionNumber
Return the primary version of the Revit application.
Public Property
VertexTolerance
Vertex tolerance.
Methods
Name
Description
Public Method
CopyModel
Copies an existing model to a new file. Overwriting a file of the same name is allowed.
Public Method
Dispose
Releases all resources used by the Application
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Public Method
ExtractPartAtomFromFamilyFile
Writes a PartAtom XML from the contents of a family file.
Public Method
GetAssets
Gets all the Assets of the specified type.
Public Method
Static Member
GetFailureDefinitionRegistry
Returns the instance of FailureDefinitionRegistry.
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object)
Public Method
Code Example
GetLibraryPaths
Returns path information identifying where Revit searches for content.
Public Method
GetRevitServerNetworkHosts
Gets the list of all Revit Server Network hosts in current session.
Public Method
GetSystemsAnalysisWorkflowNames
Returns names for systems analysis workflows.
Public Method
GetSystemsAnalysisWorkflows
Returns name and path information identifying systems analysis workflow files.
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
GetWorksharingCentralGUID
Gets the worksharing central GUID of the given server-based model.
Public Method
IsJournalPlaying
Determines if the application is currently in journal playback mode.
Public Method
Static Member
IsValidThickness
Checks if the input value is valid to be supplied as a thickness (for an extrusion, or blend, or wall layer, or similar geometric construct).
Public Method
Code Example
NewFamilyDocument
New family document, including family, titleblock, and annotation symbol
Public Method
NewProjectDocument(String)
New project document
Public Method
NewProjectDocument(UnitSystem)
Creates a new project document with no template file specified.
Public Method
NewProjectTemplateDocument
New project template document
Public Method
OpenDocumentFile(String)
Opens a document from disk.
Public Method
Code Example
OpenDocumentFile(ModelPath, OpenOptions)
Opens a document from disk or cloud.
Public Method
OpenDocumentFile(ModelPath, OpenOptions, IOpenFromCloudCallback)
Opens a document from disk or cloud.
Public Method
OpenIFCDocument(String)
Opens an IFC document from disk using default options.
Public Method
OpenIFCDocument(String, IFCImportOptions)
Opens an IFC document from disk using custom options.
Public Method
OpenSharedParameterFile
Enables access to shared parameter groups and definitions that are maintained on disk.
Public Method
PurgeReleasedAPIObjects
Explicitly purges all API objects that have been released but are still awaiting to be finalized
Public Method
Static Member
RegisterFailuresProcessor
Replaces Revit’s default user interface (if present) with alternative handling for all warnings and errors (including those not generated by your application) for the rest of the Revit session; if your application is not prepared to respond to all warnings and errors, consider use of IFailuresPreprocessor (in your opened Transaction) or the FailuresProcessing event instead of this interface.
Public Method
SetLibraryPaths
Sets path information identifying where Revit searches for content.
Public Method
SetSystemsAnalysisWorkflows
Sets name and path information identifying systems analysis workflow files.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Public Method
UpdateRenderAppearanceLibrary
Updates the stored render appearance library, giving the Revit session access to any new RPC content.
Public Method
WriteJournalComment
Writes a comment to the Revit journal file.
Events
Name
Description
Public Event
ApplicationInitialized
Subscribe to this event to get notified after the Revit application has been initialized
Public Event
DocumentChanged
Subscribe to the DocumentChanged event to be notified when Revit document has changed.
Public Event
DocumentClosed
Subscribe to the DocumentClosing event to be notified when Revit is just about to close a document.
Public Event
DocumentClosing
Subscribe to the DocumentClosing event to be notified when Revit is just about to close a document.
Public Event
DocumentCreated
Subscribe to the DocumentCreated event to be notified immediately after Revit has finished creating a new document.
Public Event
DocumentCreating
Subscribe to the DocumentCreating event to be notified when Revit is just about to create a new document.
Public Event
Code Example
DocumentOpened
Subscribe to the DocumentOpened event to be notified immediately after Revit has finished opening a document.
Public Event
DocumentOpening
Subscribe to the DocumentOpening event to be notified when Revit is just about to open a document.
Public Event
Code Example
DocumentPrinted
Subscribe to the DocumentPrinted event to be notified immediately after Revit has finished printing a view or ViewSet of the document.
Public Event
Code Example
DocumentPrinting
Subscribe to the DocumentPrinting event to be notified when Revit is just about to print a view or ViewSet of the document.
Public Event
DocumentReloadedLatest
Subscribe to the DocumentReloadedLatestEventArgs event to be notified immediately after Revit has finished reloading a document with central model.
Public Event
DocumentReloadingLatest
Subscribe to the DocumentReloadingLatestEventArgs event to be notified when Revit is just about to reload latest changes from a central model.
Public Event
DocumentSaved
Subscribe to the DocumentSaved event to be notified immediately after Revit has finished saving a document.
Public Event
DocumentSavedAs
Subscribe to the DocumentSavedAs event to be notified immediately after Revit has finished saving document with a new file name.
Public Event
DocumentSaving
Subscribe to the DocumentSaving event to be notified when Revit is just about to save a document.
Public Event
Code Example
DocumentSavingAs
Subscribe to the DocumentSavingAs event to be notified when Revit is just about to save the document with a new file name.
Public Event
DocumentSynchronizedWithCentral
Subscribe to the DocumentSynchronizedWithCentral event to be notified immediately after Revit has finished synchronizing a document with central model.
Public Event
DocumentSynchronizingWithCentral
Subscribe to the DocumentSynchronizingWithCentral event to be notified when Revit is just about to synchronize a document with central model.
Public Event
DocumentWorksharingEnabled
Subscribe to the DocumentWorksharingEnabled event to be notified when a document has become workshared.
Public Event
ElementTypeDuplicated
Subscribe to the ElementTypeDuplicated event to be notified immediately after Revit has finished duplicating an element type.
Public Event
ElementTypeDuplicating
Subscribe to the ElementTypeDuplicating event to be notified when Revit is just about to duplicate an element type.
Public Event
Code Example
FailuresProcessing
Subscribe to the FailuresProcessing event to be notified when failures are being processed at the end of transaction.
Public Event
FamilyLoadedIntoDocument
Subscribe to the FamilyLoadedInto event to be notified after Revit loaded a family into a document.
Public Event
FamilyLoadingIntoDocument
Subscribe to the FamilyLoadingInto event to be notified when Revit is just about to load a family into a document.
Public Event
FileExported
Subscribe to the FileExported event to be notified immediately after Revit has finished exporting files of formats supported by the API.
Public Event
FileExporting
Subscribe to the FileExporting event to be notified when Revit is just about to export files of formats supported by the API.
Public Event
FileImported
Subscribe to the FileImported event to be notified immediately after Revit has finished importing a file of format supported by the API.
Public Event
FileImporting
Subscribe to the FileImporting event to be notified when Revit is just about to import a file of format supported by the API.
Public Event
LinkedResourceOpened
Subscribe to the LinkedResourceOpened event to be notified immediately after Revit has finished opening a linked resource.
Public Event
LinkedResourceOpening
Subscribe to the LinkedResourceOpening event to be notified when Revit is just about to open a linked resource.
Public Event
ProgressChanged
Subscribe to the ProgressChanged event to be notified when an operation in Revit has progress bar data available.
Public Event
ViewExported
Subscribe to the ViewExported event to be notified immediately after Revit has finished exporting a view of the document.
Public Event
ViewExporting
Subscribe to the ViewExporting event to be notified when Revit is just about to export a view of the document.
Public Event
Code Example
ViewPrinted
Subscribe to the ViewPrinted event to be notified immediately after Revit has finished printing a view of the document.
Public Event
Code Example
ViewPrinting
Subscribe to the ViewPrinting event to be notified when Revit is just about to print a view of the document.
Public Event
ViewsExportedByContext
Subscribe to the ViewsExportedByContext event to be notified immediately after Revit has finished exporting one or more views of the document via an export context by CustomExporter.
Public Event
ViewsExportingByContext
Subscribe to the ViewsExportingByContext event to be notified when Revit is just about to export one or more views of the document via an export context by CustomExporter.
Public Event
WorksharedOperationProgressChanged
Subscribe to the WorksharedOperationProgressChanged to be notified when progress has changed during Collaboration for Revit’s workshared operations: open model and synchronize with central.
Example
string versionInfo = application.VersionBuild + "\n" + application.VersionName + "\n" + application.VersionNumber;