Create Method (Document, View, ExternalResourceReference, ImportOptions3DM, LinkLoadResult)


Creates a new instance of 3DM link type from an external resource reference and loads the linked file.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)
Since: 2022

Syntax

C#
public static ImportInstance Create(
	Document document,
	View DBView,
	ExternalResourceReference resourceReference,
	ImportOptions3DM options,
	out LinkLoadResult linkLoadResult
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	DBView As View, _
	resourceReference As ExternalResourceReference, _
	options As ImportOptions3DM, _
	<OutAttribute> ByRef linkLoadResult As LinkLoadResult _
) As ImportInstance
Visual C++
public:
static ImportInstance^ Create(
	Document^ document, 
	View^ DBView, 
	ExternalResourceReference^ resourceReference, 
	ImportOptions3DM^ options, 
	[OutAttribute] LinkLoadResult^% linkLoadResult
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document in which to create the 3DM link.
DBView
Type: Autodesk.Revit.DB View
The view into which the 3DM link will be created.
resourceReference
Type: Autodesk.Revit.DB ExternalResourceReference
The external resource reference describing the source of the 3DM link.
options
Type: Autodesk.Revit.DB ImportOptions3DM
Various import options applicable to the 3DM format. If a null reference ( Nothing in Visual Basic) , all options will be set to their respective default values.
linkLoadResult
Type: Autodesk.Revit.DB LinkLoadResult %
An object containing the results of creating and loading the 3DM link. It contains the ElementId of the new created 3DM link type.

Return Value

The new instance of 3DM link type created.

Remarks

This function creates a new 3DM link type as well as a new instance of this 3DM link type. The new instance of 3DM link type is returned by this function and the element id of the new 3DM link type is contained in the LinkLoadResult.

If the given external resource reference of the 3DM link is already used by an existing 3DM link type, a new instance of this existing 3DM link type is created and returned. The element id of the existing 3DM link type is contained in the LinkLoadResult.

This function regenerates the input document.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions 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.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions 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.
Autodesk.Revit.Exceptions ModificationOutsideTransactionException The document has no open transaction.
Autodesk.Revit.Exceptions OptionalFunctionalityNotAvailableException The 3DM Import/Link module is not available in the installed Revit.

See Also