Element |
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

public static ICollection<ElementId> CopyElements(
View sourceView,
ICollection<ElementId> elementsToCopy,
View destinationView,
Transform additionalTransform,
CopyPasteOptions options
)
Parameters
- sourceView View
- The view in the source document that contains the elements to copy.
- elementsToCopy ICollection ElementId
- The set of elements to copy.
- destinationView View
- The view in the destination document that the elements will be pasted into.
- additionalTransform Transform
- The transform for the new elements, in addition to the transformation between the source and destination views. Can be if no transform is required. The transformation must be within the plane of the destination view.
- options CopyPasteOptions
- Optional settings. Can be if default settings should be used.
Return Value
ICollection ElementIdThe ids of the newly created copied elements.

Exception | Condition |
---|---|
ArgumentException | The given element id set is empty. -or- The specified view cannot be used as a source or destination for copying elements between two views. -or- Some of the elements cannot be copied, because they belong to a different document. -or- Some of the elements cannot be copied, because they belong to a different view. -or- The elements cannot be copied into the destination view. Drafting views cannot contain model elements. -or- The transformation is not within the plane of the destination view. -or- The input set of elements contains Sketch members along with other elements and the Sketch Id of those members isn't in the set. |
ArgumentNullException | A non-optional argument was null |
InvalidOperationException | It is not allowed to copy Sketch members between non-parallel sketches. -or- The elements cannot be copied. |
OperationCanceledException | User cancelled the operation. |

This method can be used for both view-specific and model elements.
Both source and destination views must be 2D graphics views capable of drawing details and view-specific elements (floor and ceiling plans, elevations, sections, drafting views.) Drafting views cannot be used as a destination for model elements.
The pasted elements are repositioned to ensure proper placement in the destination view (e.g. elevation is changed when copying from a level to a different level.) Additional transformation within the destination view can be performed by providing additionalTransform argument. This additional transformation must be within the plane of the destination view.
The destination view can be in the same document as the source view.
The destination view can be the same as the source view.
All view-specific elements in the set must be specific to the source view. Elements specific to views other than the source view or to multiple views cannot be copied.
This method performs rehosting of elements where applicable.

// The method copies view-specific DetailCurve.
public void CopyDetailCurve(Autodesk.Revit.DB.DetailCurve curve, Autodesk.Revit.DB.View destinationView)
{
var ownerView = curve.Document.GetElement(curve.OwnerViewId) as Autodesk.Revit.DB.View;
Transform transform = Transform.CreateTranslation(new XYZ(150, 150, 0));
CopyPasteOptions options = new CopyPasteOptions();
ElementTransformUtils.CopyElements(ownerView, new List<ElementId> { curve.Id }, destinationView, transform, options);
}
// The method copies sketch curves from the Floor Sketch to the Document to create independent ModelCurves
// that would replicate curves in the sketch.
public void CopySketchMembersToDocument(Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.Floor floor, Autodesk.Revit.DB.View destinationView)
{
var floorSketch = document.GetElement(floor.SketchId) as Sketch;
// Select only curve elements from Sketch.
var sketchCurves = floorSketch.GetAllElements().Where(id => document.GetElement(id) is ModelCurve).ToList();
var transform = Transform.CreateTranslation(new XYZ(150, 150, 0));
var copiedIds = ElementTransformUtils.CopyElements(
destinationView, sketchCurves, destinationView, transform, new CopyPasteOptions());
}
