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: 24.0.0.0 (24.0.0.0)
Since: 2012
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- document
- Type: Autodesk.Revit.DBDocument
The document that owns the elements.
- elementsToCopy
- Type: System.Collections.GenericICollectionElementId
The set of elements to copy.
- translation
- Type: Autodesk.Revit.DBXYZ
The translation vector for the new elements.
Return Value
The ids of the newly created copied elements.Remarks
This method is not suitable for elements that are hosted in other elements as it does not perform rehosting. If you need to rehost your elements in addition to copying them, use one of the other CopyElements() overloads.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.ExceptionsArgumentException | 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. |
Autodesk.Revit.ExceptionsArgumentNullException | A non-optional argument was null |
Autodesk.Revit.ExceptionsInvalidOperationException | It is not allowed to copy Sketch members between non-parallel sketches. -or- If we are not able to copy all the elements. |