Revit 2018 API |
UIApplication..::..OpenAndActivateDocument Method (ModelPath, OpenOptions, Boolean) |
UIApplication Class See Also |
Opens and activates a Revit document.
Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 18.0.0.0 (18.2.0.13)
Since:
2013
Syntax
C# |
---|
public UIDocument OpenAndActivateDocument( ModelPath modelPath, OpenOptions openOptions, bool bDetachAndPrompt ) |
Visual Basic |
---|
Public Function OpenAndActivateDocument ( _ modelPath As ModelPath, _ openOptions As OpenOptions, _ bDetachAndPrompt As Boolean _ ) As UIDocument |
Visual C++ |
---|
public: UIDocument^ OpenAndActivateDocument( ModelPath^ modelPath, OpenOptions^ openOptions, bool bDetachAndPrompt ) |
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 nullNothingnullptra null reference (Nothing in Visual Basic) is passed as 'modelPath'. |
Autodesk.Revit.Exceptions..::..ArgumentNullException | If nullNothingnullptra 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. |