Document.Import(String, DGNImportOptions, View, ElementId)
Method
Description:
Imports a DGN file to the document.
Imports a DGN file to the document.
Syntax
Parameters
Parameter | Type | Description |
---|---|---|
file | String | Full path of the file to import. File must exist and must be a valid DGN file. |
options | DGNImportOptions | Various options applicable to the DGN format. If <span class="keyword"><span data-languagespecifictext="cpp=nullptr|vb=Nothing|nu=null" id="LSTD6F8064C_2"></span></span>, all options will be set to their respective default values. |
pDBView | View | View used to aid placement of the imported file. If the options specify ThisViewOnly, this argument is required and the imported file will only be visible in the specified view. If the options specify center-to-center placement, this argument is required and the imported file will be placed in the center of the specified view. Otherwise, this view is used to obtain a base level to associate with the imported file. If not specified, an existing view will be chosen instead and may open a view or associate the imported file to an arbitrary level. |
elementId | ElementId | The id of imported instance after a successful import. |
Return Value
Type | Description |
---|---|
Boolean | True if successful, otherwise False. |
Exceptions
Exception | Condition |
---|---|
ArgumentException | Not a valid file for DGN import (.dgn files are valid). -or- ThisViewOnly cannot be true when importing a DWG|DGN drawing into a 3D view. -or- The provided view is not valid for the options provided. -or- One or more strings describing layer selection is invalid or empty. -or- The scale is not valid as a CustomScale for use during import. -or- NullOrEmpty -or- The view is not printable. -or- Empty DGN model view name characters. -or- Visible layer only option must be set to false for DGN import. |
ArgumentNullException | A non-optional argument was null |
FileArgumentNotFoundException | The given file does not exist. |
InvalidOperationException | Import is temporarily disabled. |
ModificationForbiddenException | The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process. |
ModificationOutsideTransactionException | The document has no open transaction. |
OptionalFunctionalityNotAvailableException | The DGN Import/Link module is not available in the installed Revit. |