RevitLinkInstanceCreate(Document, ElementId, ImportPlacement) Method |
Creates a new instance of a linked Revit project (RevitLinkType).
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static RevitLinkInstance Create(
Document document,
ElementId revitLinkTypeId,
ImportPlacement placement
)
Public Shared Function Create (
document As Document,
revitLinkTypeId As ElementId,
placement As ImportPlacement
) As RevitLinkInstance
public:
static RevitLinkInstance^ Create(
Document^ document,
ElementId^ revitLinkTypeId,
ImportPlacement placement
)
static member Create :
document : Document *
revitLinkTypeId : ElementId *
placement : ImportPlacement -> RevitLinkInstance
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.
ExceptionsException | 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.
See Also