RVTDocs.com

RevitLinkInstance.Create(Document, ElementId, ImportPlacement)

Method
Description:
Creates a new instance of a linked Revit project (RevitLinkType).
Remarks:
Instances will be placed origin-to-origin or by shared coordinates. This function cannot be used to create instances of nested links.
Syntax
public static RevitLinkInstance Create(
	Document document,
	ElementId revitLinkTypeId,
	ImportPlacement placement
)
Parameters
Parameter Type Description
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
Type Description
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.