Copies an existing model to a new file. Overwriting a file of the same name is allowed.

Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since:  2012

Syntax

C#
public void CopyModel(
	ModelPath sourceModelPath,
	string destFilePath,
	bool overwrite
)
Visual Basic
Public Sub CopyModel ( _
	sourceModelPath As ModelPath, _
	destFilePath As String, _
	overwrite As Boolean _
)
Visual C++
public:
void CopyModel(
	ModelPath^ sourceModelPath, 
	String^ destFilePath, 
	bool overwrite
)

Parameters

sourceModelPath
Type: Autodesk.Revit.DB..::..ModelPath
The path of the file-based or server-based source model.
destFilePath
Type: System..::..String
The path of the destination file.
overwrite
Type: System..::..Boolean
True if the destination file can be overwritten; otherwise, false.

Exceptions

ExceptionCondition
Autodesk.Revit.Exceptions..::..ArgumentException The given path sourceModelPath is a cloud path which is not supported in this method.
Autodesk.Revit.Exceptions..::..ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions..::..CentralModelAccessDeniedException Access to the central model was denied. A possible reason is because the model was under maintenance.
Autodesk.Revit.Exceptions..::..CentralModelException The central model is missing. -or- An internal error happened on the central model, please contact the server administrator.
Autodesk.Revit.Exceptions..::..DirectoryNotFoundException Thrown when the directory of destination file doesn't exist.
Autodesk.Revit.Exceptions..::..FileArgumentAlreadyExistsException The destination file exists and can't be overwritten. -or- destFilePath is pointing to a folder that already exists and cannot be deleted.
Autodesk.Revit.Exceptions..::..FileArgumentNotFoundException The Revit model specified by sourceModelPath doesn't exist.
Autodesk.Revit.Exceptions..::..InvalidPathArgumentException The destination file name includes one or more invalid characters.
Autodesk.Revit.Exceptions..::..RevitServerCommunicationException The server-based central model could not be accessed because of a network communication error.
Autodesk.Revit.Exceptions..::..RevitServerInternalException An internal error happened on the server, please contact the server administrator.

See Also