Create Method (Document, ElementId, ImportPlacement)


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

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 18.0.0.0 (18.0.0.420)
Since: 2018

Syntax

C#
public static RevitLinkInstance Create(
	Document document,
	ElementId revitLinkTypeId,
	ImportPlacement placement
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	revitLinkTypeId As ElementId, _
	placement As ImportPlacement _
) As RevitLinkInstance
Visual C++
public:
static RevitLinkInstance^ Create(
	Document^ document, 
	ElementId^ revitLinkTypeId, 
	ImportPlacement placement
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document in which the new instance should be created.
revitLinkTypeId
Type: Autodesk.Revit.DB ElementId
The element id of the RevitLinkType.
placement
Type: Autodesk.Revit.DB ImportPlacement
The mode where to place the RevitLinkInstance. Set this option to place the view at the origin or by shared coordinates.

Return Value

The newly-created RevitLinkInstance.

Remarks

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

Exceptions

Exception Condition
Autodesk.Revit.Exceptions 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.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration
Autodesk.Revit.Exceptions 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.
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.

See Also