Copies a set of elements and places the copies at a location indicated by a given translation.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
public static ICollection<ElementId> CopyElements( Document document, ICollection<ElementId> elementsToCopy, XYZ translation )
Parameters
- document Document
- The document that owns the elements.
- elementsToCopy ICollection<ElementId>
- The set of elements to copy.
- translation XYZ
- The translation vector for the new elements.
Return Value
ICollection<ElementId>The ids of the newly created copied elements.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentException | The given element id set is empty. -or- One or more elements in elementsToCopy do not exist in the document. -or- Some of the elements cannot be copied, because they belong to different views. -or- The input set of elements contains Sketch members along with other elements or there is no active Sketch edit mode. |
| ArgumentNullException | A non-optional argument was null |
| InvalidOperationException | It is not allowed to copy Sketch members between non-parallel sketches. -or- If we are not able to copy all the elements. |
