RevitLinkInstance.Create(Document, ElementId)
Method
Description:
Creates a new instance of a linked Revit project (RevitLinkType).
Creates a new instance of a linked Revit project (RevitLinkType).
Remarks:
Instances will be placed origin-to-origin. This function cannot be used to create instances of nested links.
Instances will be placed origin-to-origin. This function cannot be used to create instances of nested links.
Examples
public void CreateLinkInstances(Document doc, ElementId linkTypeId)
{
// Create revit link instance at origin
RevitLinkInstance.Create(doc, linkTypeId);
RevitLinkInstance instance2 = RevitLinkInstance.Create(doc, linkTypeId);
Location location = instance2.Location;
// Create a second instance of the link and offset it by 100 feet.
location.Move(new XYZ(0, -100, 0));
}
Parameters
Parameter | Type | Description |
---|---|---|
document | Document | The document in which the new instance should be created. |
revitLinkTypeId | ElementId | The element id of the RevitLinkType. |
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. |
ArgumentNullException | A non-optional argument was null |
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. |