ImportInstance.Create(Document, View, ExternalResourceReference, STEPImportOptions, LinkLoadResult)
Method
Description:
Creates a new instance of STEP link type from an external resource reference and loads the linked file.
Creates a new instance of STEP link type from an external resource reference and loads the linked file.
Remarks:
This function creates a new STEP link type as well as a new instance of this STEP link type. The new instance of STEP link type is returned by this function and the element id of the new STEP link type is contained in the LinkLoadResult.
If the given external resource reference of the STEP link is already used by an existing STEP link type, a new instance of this existing STEP link type is created and returned. The element id of the existing STEP link type is contained in the LinkLoadResult.
This function regenerates the input document.
Syntax
public static ImportInstance Create(
Document document,
View DBView,
ExternalResourceReference resourceReference,
STEPImportOptions options,
out LinkLoadResult linkLoadResult
)
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The document in which to create the STEP link. |
DBView | View | The view into which the STEP link will be created. |
resourceReference | ExternalResourceReference | The external resource reference describing the source of the STEP link. |
options | STEPImportOptions | Various import options applicable to the STEP format. If <span class="keyword"><span data-languagespecifictext="cpp=nullptr|vb=Nothing|nu=null" id="LST488B6358_2"></span></span>, all options will be set to their respective default values. |
linkLoadResult | LinkLoadResult | An object containing the results of creating and loading the STEP link. It contains the ElementId of the new created STEP link type. |
Return Value
Type | Description |
---|---|
ImportInstance | The new instance of STEP link type created. |
Exceptions
Exception | Condition |
---|---|
ArgumentException | 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 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. |
ArgumentNullException | A non-optional argument was null |
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 STEP Import/Link module is not available in the installed Revit. |