Creates a new instance of DWG link type from an external resource reference and loads the linked file.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2018
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- document
- Type: Autodesk.Revit.DBDocument
The document in which to create the DWG link.
- DBView
- Type: Autodesk.Revit.DBView
The view into which the DWG link will be created.
- resourceReference
- Type: Autodesk.Revit.DBExternalResourceReference
The external resource reference describing the source of the DWG link.
- options
- Type: Autodesk.Revit.DBDWGImportOptions
Various import options applicable to the DWG format. If a null reference (Nothing in Visual Basic), all options will be set to their respective default values.
- linkLoadResult
- Type: Autodesk.Revit.DBLinkLoadResult%
An object containing the results of creating and loading the DWG link. It contains the ElementId of the new created DWG link type.
Return Value
The new instance of DWG link type created.Remarks
This function creates a new DWG link type as well as a new instance of this DWG link type. The new instance of DWG link type is returned by this function and the element id of the new DWG link type is contained in the LinkLoadResult.
If the given external resource reference of the DWG link is already used by an existing DWG link type, a new instance of this existing DWG link type is created and returned. The element id of the existing DWG link type is contained in the LinkLoadResult.
This function regenerates the input document.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.ExceptionsArgumentException | document is not a project document. -or- document is in an edit mode. -or- Import is temporarily disabled. -or- The view is not printable. -or- ThisViewOnly cannot be true when importing a DWG|DGN drawing into a 3D view. -or- One or more strings describing layer selection is invalid or empty. -or- The line weights are not valid; either it contains an invalid number of line weights, or a line weight outside the valid range. -or- The scale is not valid as a CustomScale for use during import. -or- The server referenced by the ExternalResourceReference does not exist or does not implement IExternalResourceServer. -or- The server referenced by the ExternalResourceReference cannot support CAD links. -or- The ExternalResourceReference (resourceReference) is not in a format that is supported by its server. |
Autodesk.Revit.ExceptionsArgumentNullException | A non-optional argument was null |
Autodesk.Revit.ExceptionsModificationForbiddenException | 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. |
Autodesk.Revit.ExceptionsModificationOutsideTransactionException | The document has no open transaction. |
Autodesk.Revit.ExceptionsOptionalFunctionalityNotAvailableException | The DWG Import/Link module is not available in the installed Revit. |