CopyElement Method


Element Transform Utils Copy Element Method

Copies an element and places the copy at a location indicated by a given transformation.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public static ICollection<ElementId> CopyElement(
	Document document,
	ElementId elementToCopy,
	XYZ translation
)

Parameters

document Document
The document that owns the element.
elementToCopy ElementId
The id of the element to copy.
translation XYZ
The translation vector for the new element.

Return Value

ICollection ElementId
The ids of the newly created copied elements. More than one element may be created due to dependencies.
Exceptions
Exception Condition
ArgumentException The element elementToCopy does not exist in the document -or- The input element is a Sketch member and there is no Sketch in the edit mode to place this element in.
ArgumentNullException A non-optional argument was null
InvalidOperationException It is not allowed to copy Sketch member to non-parallel sketch. -or- If we are not able to copy the element.
See Also