Document Class

An object that represents an open Autodesk Revit project.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBDocument

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class Document : IDisposable

The Document type exposes the following members.

Properties
 NameDescription
Public propertyActiveProjectLocationRetrieve the active project location.
Public propertyCode exampleActiveViewThe document's active view.
Public propertyApplicationReturns the Application in which the Document resides.
Public propertyCreateAn object that can be used to create new instances of Autodesk Revit API elements within a project.
Public propertyCreationGUID A unique identifier generated when the Document was first created.
Public propertyDisplayUnitSystemProvides access to display unit type with in the document.
Public propertyFamilyCreateAn object that can be used to create new instances of Autodesk Revit API elements within a family document.
Public propertyFamilyManagerThe family manager object provides access to family types and parameters.
Public propertyIsDetached Identifies if a workshared document is detached. Also, see IsWorkshared
Public propertyIsFamilyDocumentIdentifies if the current document is a family document.
Public propertyIsLinked Identifies if a document is a linked RVT.
Public propertyIsModelInCloud Identifies if document is stored on Autodesk cloud services.
Public propertyIsModifiable Identifies if the document is modifiable.
Public propertyIsModified The state of changes made to the document.
Public propertyIsReadOnly Identifies if the document is read-only or can possibly be modified.
Public propertyIsReadOnlyFile Signals whether the document was opened from a read-only file.
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public propertyIsWorkshared Identifies if worksharing (i.e. editing permissions and multiple worksets) have been enabled in the document. Also, see IsDetached
Public propertyMassDisplayTemporaryOverride This setting controls temporary display in views of objects with mass category or subcategories.
Public propertyMullionTypesThis property is used to retrieve all the mullion types in current system.
Public propertyCode exampleOwnerFamilyGet the Family of this Family Document.
Public propertyPanelTypesRetrieves a set of PanelType objects that contains all the panel types that are currently loaded into the project.
Public propertyParameterBindingsRetrieves an object from which mappings between parameter definitions and categories can be found.
Public propertyCode examplePathName The fully qualified path of the document's disk file.
Public propertyCode examplePhasesRetrieves all of the phases in the document.
Public propertyPlanTopologiesGet the PlanTopologies of the current project in the last phase.
Public propertyPlanTopologiesPhaseGets the PlanTopologies of the current project in a given phase.
Public propertyPlanTopologyLevelGet the PlanTopology of a given level in the last phase.
Public propertyPlanTopologyLevel, PhaseGet the PlanTopology of a given level in a given phase.
Public propertyPrintManager Retrieve the PrintManager of current project.
Public propertyProjectInformationReturn the Project Information of the current project.
Public propertyProjectLocationsRetrieve all the project locations associated with this project
Public propertyReactionsAreUpToDateReports if the analytical model has regenerated in a document with reaction loads.
Public propertySettingsProvides access to general application settings, such as Categories.
Public propertySiteLocationReturns the site location information.
Public propertyTitle The document's title.
Public propertyTypeOfStorageGet the storage type of the specified BuiltInParameter.
Public propertyWorksharingCentralGUID The central GUID of the server-based model.
Top
Methods
 NameDescription
Public methodAcquireCoordinates Acquires coordinates from the specified link instance.
Public methodAutoJoinElementsForces the elements in the Revit document to automatically join to their neighbors where appropriate.
Public methodCanEnableCloudWorksharing Checks if cloud worksharing can be enabled for the cloud model.
Public methodCanEnableWorksharing Checks if worksharing can be enabled in the document.
Public methodCloseCloses the document, save the changes if there are.
Public methodClose(Boolean)Closes the document with the option to save.
Public methodCombineElementsCombine a set of combinable elements into a geometry combination.
Public methodConvertDetailToModelCurvesConverts a group of DetailCurves to equivalent ModelCurves.
Public methodConvertModelToDetailCurvesConverts a group of ModelCurves to equivalent DetailCurves.
Public methodConvertModelToSymbolicCurvesConverts a group of ModelCurves to equivalent SymbolicCurves.
Public methodConvertSymbolicToModelCurvesConverts a group of SymbolicCurves to equivalent ModelCurves.
Public methodCode exampleDelete(ElementId) Deletes an element from the document given the id of that element.
Public methodCode exampleDelete(ICollectionElementId) Deletes a set of elements from the document.
Public methodDisposeReleases all resources used by the Document
Public methodCode exampleEditFamilyGets the document of a loaded family to edit.
Public methodEnableCloudWorksharing Enables cloud worksharing for a cloud model
Public methodEnableWorksharing Enables worksharing in the document.
Public methodEquals Determines whether the specified Object equals to this Object.
(Overrides ObjectEquals(Object))
Public methodEraseSchemaAndAllEntities Erases Schema and all its Entities from the document.
Public methodExport(String, IListElementId, PDFExportOptions) Exports a selection of views in PDF format.
Public methodExport(String, String, GBXMLExportOptions) Export the model in gbXML (green-building) format.
Public methodExport(String, String, IFCExportOptions) Exports the document to the Industry Standard Classes (IFC) format.
Public methodExport(String, String, NavisworksExportOptions) Exports a Revit project to the Navisworks .nwc format.
Public methodExport(String, String, OBJExportOptions) Exports a view specified in the export options to the OBJ format.
Public methodExport(String, String, STEPExportOptions) Exports the current view or a selection of views in STEP format.
Public methodExport(String, String, STLExportOptions) Exports a view specified in the export options to the STL format.
Public methodCode exampleExport(String, String, ViewSet, DWFExportOptions)Exports the current view or a selection of views in DWF format.
Public methodExport(String, String, ViewSet, DWFXExportOptions)Exports the current view or a selection of views in DWFX format.
Public methodExport(String, String, ViewSet, FBXExportOptions)Exports the document in 3D-Studio Max (FBX) format.
Public methodCode exampleExport(String, String, ICollectionElementId, DGNExportOptions) Exports a selection of views in DGN format.
Public methodCode exampleExport(String, String, ICollectionElementId, DWGExportOptions) Exports a selection of views in DWG format.
Public methodExport(String, String, ICollectionElementId, DXFExportOptions) Exports a selection of views in DXF format.
Public methodExport(String, String, ICollectionElementId, SATExportOptions) Exports the current view or a selection of views in SAT format.
Public methodExportImage Exports a view or set of views into an image file.
Public methodCode exampleGetAllUnusedElements Returns the list of element ids that are not used. The list of unused element ids may include elements that can't be deleted.
Public methodCode exampleGetChangedElements Extracts a collection containing the ids of elements that have been created, modified or deleted between the input baseVersion and the document's current version.
Public methodGetCloudFolderId Gets ForgeDM folder id where the model locates.
Public methodGetCloudModelPath Gets the cloud model path of the cloud model.
Public methodGetCloudModelUrn A ForgeDM Urn identifying the model.
Public methodCode exampleGetDefaultElementTypeId Gets the default element type id with the given DefaultElementType id.
Public methodCode exampleGetDefaultFamilyTypeId Gets the default family type id with the given family category id.
Public methodGetDocumentPreviewSettings Returns the preview settings for the given document.
Public methodStatic memberGetDocumentVersion Gets the DocumentVersion that corresponds to a document.
Public methodGetElement(ElementId) Gets the Element referenced by the input ElementId.
Public methodGetElement(Reference) Gets the Element referenced by the input reference.
Public methodGetElement(String) Gets the Element referenced by a unique id string.
Public methodGetHashCode Gets the hash code of this document instance.
(Overrides ObjectGetHashCode)
Public methodGetHubId Gets ForgeDM hub id where the model locates. It is cached in session.
Public methodGetPaintedMaterial Get the material painted on the element's face. Returns invalidElementId if the face is not painted.
Public methodGetPrintSettingIds Retrieves all Print Settings of current project.
Public methodGetProjectId Gets ForgeDM project id where the model locates.
Public methodGetRoomAtPoint(XYZ)Gets a room containing the point.
Public methodGetRoomAtPoint(XYZ, Phase)Gets a room containing the point.
Public methodGetSpaceAtPoint(XYZ)Gets a space containing the point.
Public methodGetSpaceAtPoint(XYZ, Phase)Gets a space containing the point.
Public methodGetSubelement(Reference) Gets the subelement referenced by the input reference.
Public methodGetSubelement(String) Gets the subelement referenced by a unique id string.
Public methodGetSubelement(ElementId, Int32) Gets the subelement referenced by a parent id and subelement id.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetTypeOfStorage Get the storage type of the identified built-in parameter.
Public methodGetUnits Gets the Units object.
Public methodCode exampleGetUnusedElements Returns the list of element ids that are not used and can be deleted from the document.
Public methodGetWarnings Returns list of failure messages generated from persistent (reviewable) warnings accumulated in the document.
Public methodGetWorksetId Get Id of the Workset which owns the element.
Public methodGetWorksetTable Get the WorksetTable of this document.
Public methodGetWorksharingCentralModelPath Gets the central model path of the worksharing model.
Public methodCode exampleHasAllChangesFromCentral Returns whether the model in the current session is up to date with central.
Public methodImport(String, GBXMLImportOptions)Imports a Green-Building XML file into the document.
Public methodImport(String, AXMImportOptions, View) Imports an AXM file into the document.
Public methodImport(String, ImportOptions3DM, View) Imports a 3DM file into the document.
Public methodImport(String, OBJImportOptions, View) Imports an OBJ file into the document.
Public methodImport(String, SATImportOptions, View) Imports an SAT file into the document.
Public methodImport(String, SKPImportOptions, View) Imports a SKP file into the document.
Public methodImport(String, STEPImportOptions, View) Imports a STEP file into the document.
Public methodImport(String, STLImportOptions, View) Imports an STL file into the document.
Public methodImport(String, DGNImportOptions, View, ElementId) Imports a DGN file to the document.
Public methodImport(String, DWGImportOptions, View, ElementId) Imports a DWG or DXF file to the document.
Public methodIsBackgroundCalculationInProgress Indicates whether there are any background calculations in progress for this document.
Public methodIsDefaultElementTypeIdValid Checks whether the element type id is valid for the give DefaultElmentType id.
Public methodIsDefaultFamilyTypeIdValid Checks whether the family type id is valid for the give family category.
Public methodIsPainted Checks if the element's face is painted with a material.
Public methodStatic memberIsValidVersionGUID Checks whether the GUID is valid for the given document. Empty GUID is allowed.
Public methodLink(String, DWFImportOptions) Links Markups in a DWF file into the project document.
Public methodLink(String, ImportOptions3DM, View) Links a 3DM file into the project document.
Public methodLink(String, OBJImportOptions, View) Links an OBJ file into the project document.
Public methodLink(String, SATImportOptions, View) Links an SAT file into the project document.
Public methodLink(String, SKPImportOptions, View) Links a SKP file into the project document.
Public methodLink(String, STEPImportOptions, View) Links an STEP file into the project document.
Public methodLink(String, STLImportOptions, View) Links an STL file into the project document.
Public methodLink(String, DGNImportOptions, View, ElementId) Links a DGN file into the project document.
Public methodLink(String, DWGImportOptions, View, ElementId) Links a DWG or DXF file into the project document.
Public methodLoadFamily(Document) Loads the contents of this family document into another document.
Public methodLoadFamily(String)Loads an entire family and all its types/symbols into the document.
Public methodLoadFamily(Document, IFamilyLoadOptions) Loads the contents of this family document into another document.
Public methodCode exampleLoadFamily(String, Family)Loads an entire family and all its types/symbols into the document and provides a reference to the loaded family.
Public methodLoadFamily(String, IFamilyLoadOptions, Family)Loads an entire family and all its types/symbols into the document and provides a reference to the loaded family.
Public methodLoadFamilySymbol(String, String)Loads only a specified family type/symbol from a family file into the document.
Public methodLoadFamilySymbol(String, String, FamilySymbol)Loads only the specified family type/symbol from a family file into the document and provides a reference to the loaded family symbol.
Public methodLoadFamilySymbol(String, String, IFamilyLoadOptions, FamilySymbol)Loads only the specified family type/symbol from a family file into the document and provides a reference to the loaded family symbol.
Public methodMakeTransientElements This method encapsulates the process of creating transient elements in the document.
Public methodCode examplePaint(ElementId, Face, ElementId) Paint the element's face with specified material.
Public methodCode examplePaint(ElementId, Face, FamilyParameter) Paint the element's face with specified material.
Public methodCode examplePostFailure Posts a failure to be displayed to the user at the end of transaction.
Public methodPrint(ViewSet)Prints a set of views with default view template and default print settings.
Public methodPrint(ViewSet, View)Prints a set of views with a specified view template and default print settings.
Public methodPrint(ViewSet, Boolean)Prints a set of views with default view template and default print settings.
Public methodPrint(ViewSet, View, Boolean)Prints a set of views with a specified view template and default print settings.
Public methodPublishCoordinates Publish coordinates to the specified ProjectLocation of the link instance.
Public methodCode exampleRegenerateUpdates the elements in the Revit document to reflect all changes.
Public methodCode exampleReloadLatest Fetches changes from central (due to one or more synchronizations with central) and merges them into the current session.
Public methodRemovePaint Remove the material painted on the element's face. If the face is currently not painted,it will do nothing.
Public methodResetSharedCoordinates Reset shared coordinates for the host model/file.
Public methodSave Saves the document.
Public methodSave(SaveOptions) Saves the document.
Public methodSaveAs(String) Saves the document to a given file path.
Public methodSaveAs(ModelPath, SaveAsOptions) Saves the document to a given path.
Public methodCode exampleSaveAs(String, SaveAsOptions) Saves the document to a given file path.
Public methodSaveAsCloudModel Saves current non-workshared or workshared model as a cloud model or workshared cloud model in BIM 360 Docs or Autodesk Docs.
Public methodSaveCloudModel Saves cloud model.
Public methodSaveToProjectAsImage Creates an image view from the currently active view.
Public methodSeparateElementsSeparate a set of combinable elements out of combinations they currently belong to.
Public methodSetDefaultElementTypeId Sets the default element type id of the given DefaultElementType id.
Public methodCode exampleSetDefaultFamilyTypeId Sets the default family type id for the given family category.
Public methodSetUnits Sets the units.
Public methodCode exampleSynchronizeWithCentral Performs reload latest until the model in the current session is up to date and then saves changes back to central. A save to central is performed even if no changes were made.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodUnpostFailure Deletes the posted failure message associated with a given FailureMessageKey.
Top
Events
 NameDescription
Public eventDocumentClosing Subscribe to the DocumentClosing event to be notified when Revit is just about to close a document.
Public eventDocumentPrinted Subscribe to the DocumentPrinted event to be notified immediately after Revit has finished printing a view or ViewSet of the document.
Public eventDocumentPrinting Subscribe to the DocumentPrinting event to be notified when Revit is just about to print a view or ViewSet of the document.
Public eventDocumentSaved Subscribe to the DocumentSaved event to be notified immediately after Revit has finished saving a document.
Public eventDocumentSavedAs Subscribe to the DocumentSavedAs event to be notified immediately after Revit has finished saving document with a new file name.
Public eventDocumentSaving Subscribe to the DocumentSaving event to be notified when Revit is just about to save a document.
Public eventDocumentSavingAs Subscribe to the DocumentSavingAs event to be notified when Revit is just about to save the document with a new file name.
Public eventViewPrinted Subscribe to the ViewPrinted event to be notified immediately after Revit has finished printing a view of the document.
Public eventViewPrinting Subscribe to the ViewPrinting event to be notified when Revit is just about to print a view of the document.
Top
Remarks
The Document object represents an Autodesk Revit project. Revit can have multiple projects open and multiple views to those projects. The active or top most view will be the active project and hence the active document which is available from the Application object.
See Also