Opens and activates a Revit document.
Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2013
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- modelPath
- Type: Autodesk.Revit.DB ModelPath
A path to a revit file to be opened. The file can be either a Revit project, template, or family document.
- openOptions
- Type: Autodesk.Revit.DB OpenOptions
Options for opening the file.
- bDetachAndPrompt
- Type: System Boolean
True means if openOptions specifies DoNotDetach, then for workshared models detach from central and query the user whether to preserve or discard worksets.
Remarks
This method, if successful, changes the active document. It is not allowed to have an open transaction in the active document when calling this method. Consequently, this method can only be used in manual transaction mode, not in automatic mode. Additionally, this method may not be called from inside an event handler.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions ArgumentNullException | If a null reference ( Nothing in Visual Basic) is passed as 'modelPath'. |
Autodesk.Revit.Exceptions ArgumentNullException | If a null reference ( Nothing in Visual Basic) is passed as 'openOptions'. |
Autodesk.Revit.Exceptions FileArgumentNotFoundException | The file specified by 'modelPath' cannot be found or the given 'modelPath' is not a Revit file (a project, template, or family document). |
Autodesk.Revit.Exceptions ArgumentException | If the modelPath is not a FilePath |
Autodesk.Revit.Exceptions InvalidOperationException |
|
Autodesk.Revit.Exceptions RevitServerCommunicationException | If there is any network communication error. |
Autodesk.Revit.Exceptions CentralModelContentionException | If the model is being accessed by other users. |
Autodesk.Revit.Exceptions RevitServerInternalException | If there is any server internal error. |