Skip to content

RevitLinkInstance.Create(Document, ElementId, ImportPlacement)

Public Class

Creates a new instance of a linked Revit project (RevitLinkType).

Namespace: Autodesk.Revit.DB

Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Syntax

public static RevitLinkInstance Create(
Document document,
ElementId revitLinkTypeId,
ImportPlacement placement
)

Parameters

document Document

The document in which the new instance should be created.

revitLinkTypeId ElementId

The element id of the RevitLinkType.

placement ImportPlacement

The mode where to place the RevitLinkInstance. Set this option to place the view at the origin or by shared coordinates.

Return Value

RevitLinkInstance
The newly-created RevitLinkInstance.

Exceptions

Exception

Condition


ArgumentException

revitLinkTypeId isn’t a RevitLinkType. -or- revitLinkTypeId is not a top-level link. -or- revitLinkTypeId is not a loaded RevitLinkType -or- document is not a project document. -or- placement isn’t supported.Only Origin or Shared placement is supported.


ArgumentNullException

A non-optional argument was null


ArgumentOutOfRangeException

A value passed for an enumeration argument is not a member of that enumeration


InvalidOperationException

The placement is Shared, and the host model and the link do not share the same coordinate system. Or the placement is Shared, and the shared coordinates of the host model do not match the GIS coordinate system of the linked file.


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.


Remarks

Instances will be placed origin-to-origin or by shared coordinates. This function cannot be used to create instances of nested links.