UIDocument
An object that represents an Autodesk Revit project opened in the Revit user interface.
Inheritance Hierarchy
System.Object
Autodesk.Revit.UI.UIDocument
Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class UIDocument : IDisposable
The UIDocument type exposes the following members.
Constructors
Name
Description
Public Method
UIDocument
Use a database level Document to construct a UI-level Document.
Properties
Name
Description
Public Property
ActiveGraphicalView
The currently active graphical view of the currently active document.
Public Property
ActiveView
The currently active view of the currently active document.
Public Property
Application
Retrieves an object that represents the current Application.
Public Property
Document
Returns the database level document represented by this UI-level document.
Public Property
IsValidObject
Specifies whether the .NET object represents a valid Revit entity.
Public Property
Selection
Retrieve the currently selected Elements in Autodesk Revit.
Methods
Name
Description
Public Method
CanPlaceElementType
Verifies that the user can be prompted to place the input element type interactively.
Public Method
Dispose
Releases all resources used by the UIDocument
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object)
Public Method
GetOpenUIViews
Get a list of all open view windows in the Revit user interface.
Public Method
GetPlacementTypes
Get a collection of valid placement types for input family symbol.
Public Method
Static Member
GetRevitUIFamilyLoadOptions
Return the option object that allows you to use Revit’s dialog boxes to let the user respond to questions that arise during loading of families.
Public Method
GetSketchGalleryOptions
Gets the valid sketch gallery options of a family symbol.
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
PostRequestForElementTypePlacement
Places a request on Revit’s command queue for the user to place instances of the specified ElementType. This does not execute immediately, but instead when control returns to Revit from the current API context.
Public Method
PromptForFamilyInstancePlacement(FamilySymbol)
Prompts the user to place instances of the specified FamilySymbol.
Public Method
PromptForFamilyInstancePlacement(FamilySymbol, PromptForFamilyInstancePlacementOptions)
Prompts the user to place instances of the specified FamilySymbol.
Public Method
PromptToMatchElementType
Prompts the user to select elements to change them to the input type.
Public Method
PromptToPlaceElementTypeOnLegendView
Prompts the user to place an element type onto a legend view.
Public Method
PromptToPlaceViewOnSheet
Prompts the user to place a specified view onto a sheet.
Public Method
RefreshActiveView
Refresh the display of the active view in the active document.
Public Method
RequestViewChange
Requests an asynchronous change of the active view in the currently active document.
Public Method
SaveAndClose
Close the document, prompting the user for saving it when necessary.
Public Method
SaveAs.
Saves the document to a file name obtained from the Revit user without prompting the user to overwrite file if it exists.
Public Method
SaveAs(UISaveAsOptions)
Saves the document to a file name obtained from the Revit user optionally prompting the user to overwrite file if it exists.
Public Method
ShowElements(Element)
Shows the element by zoom to fit.
Public Method
ShowElements(ElementId)
Shows the element by zoom to fit.
Public Method
ShowElements(ElementSet)
Shows the elements by zoom to fit.
Public Method
ShowElements(ICollection.ElementId.)
Shows the elements by zoom to fit.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Public Method
UpdateAllOpenViews
Update all open views in this document after elements have been changed, deleted, selected or de-selected. Graphics in the views are fully redrawn regardless of which elements have changed.
Remarks
This class represents a document opened in the user interface and therefore offers interfaces to work with settings and operations in the UI (for example, the active selection). 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 UIApplication object.
Obtain the database level Document (which contains interfaces not related to the UI) via the Document property. If you have a database level Document and need to access it from the UI, you can construct a new UIDocument from that object (the document must be open and visible in the UI to allow the methods to work successfully).