Copies a set of elements from source document to destination document.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 16.0.0.0 (16.0.0.0)
Since:
2014
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- sourceDocument
-
Type:
Autodesk.Revit.DB
Document
The document that contains the elements to copy.
- elementsToCopy
-
Type:
System.Collections.Generic
ICollection
ElementId
The set of elements to copy.
- destinationDocument
-
Type:
Autodesk.Revit.DB
Document
The destination document to paste the elements into.
- transform
-
Type:
Autodesk.Revit.DB
Transform
The transform for the new elements. Can be a null reference ( Nothing in Visual Basic) if no transform is required.
- options
-
Type:
Autodesk.Revit.DB
CopyPasteOptions
Optional settings. Can be a null reference ( Nothing in Visual Basic) if default settings should be used.
Return Value
The ids of the newly created copied elements.Remarks
Copies are placed at their respective original locations or locations specified by the optional transformation.
This method can be used for copying non-view specific elements only. For copying view-specific elements, use the view-specific form of the CopyElements method.
The destination document can be the same as the source document.
This method performs rehosting of elements where applicable.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions 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 are view-specific. |
Autodesk.Revit.Exceptions ArgumentNullException | A non-optional argument was NULL |
Autodesk.Revit.Exceptions InvalidOperationException | The elements cannot be copied. |
Autodesk.Revit.Exceptions OperationCanceledException | User cancelled the operation. |