CopyModel Method


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: 24.0.0.0 (24.0.0.0)
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.DBModelPath
The path of the file-based or server-based source model.
destFilePath
Type: SystemString
The path of the destination file.
overwrite
Type: SystemBoolean
True if the destination file can be overwritten; otherwise, false.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException The given path sourceModelPath is a cloud path which is not supported in this method.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsCentralModelAccessDeniedException Access to the central model was denied. A possible reason is because the model was under maintenance.
Autodesk.Revit.ExceptionsCentralModelException The central model is missing. -or- An internal error happened on the central model, please contact the server administrator.
Autodesk.Revit.ExceptionsDirectoryNotFoundException Thrown when the directory of destination file doesn't exist.
Autodesk.Revit.ExceptionsFileArgumentAlreadyExistsException 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.ExceptionsFileArgumentNotFoundException The Revit model specified by sourceModelPath doesn't exist.
Autodesk.Revit.ExceptionsInvalidPathArgumentException The destination file name includes one or more invalid characters.
Autodesk.Revit.ExceptionsRevitServerCommunicationException The server-based central model could not be accessed because of a network communication error.
Autodesk.Revit.ExceptionsRevitServerInternalException An internal error happened on the server, please contact the server administrator.

See Also