Revit 2025 API
Project |
Generate a copy of this project location with the specified name.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public ProjectLocation Duplicate( string name )
Public Function Duplicate ( name As String ) As ProjectLocation
public: ProjectLocation^ Duplicate( String^ name )
member Duplicate : name : string -> ProjectLocation
Parameters
- name String
Return Value
ProjectLocationA new ProjectLocation which is a duplicate of this location, with the input name.

Exception | Condition |
---|---|
ArgumentNullException | A non-optional argument was null |

The name must not be the same as the name of any existing locations.
This function will modify the document, as the new ProjectLocation
will be added to it.

public ProjectLocation DuplicateLocation(Autodesk.Revit.DB.Document document, string newName) { ProjectLocation currentLocation = document.ActiveProjectLocation; ProjectLocationSet locations = document.ProjectLocations; foreach (ProjectLocation projectLocation in locations) { if (projectLocation.Name == newName) { throw new Exception("The name is same as a project location's name, please change one."); } } return currentLocation.Duplicate(newName); }
Public Function DuplicateLocation(document As Autodesk.Revit.DB.Document, newName As String) As ProjectLocation Dim currentLocation As ProjectLocation = document.ActiveProjectLocation Dim locations As ProjectLocationSet = document.ProjectLocations For Each projectLocation As ProjectLocation In locations If projectLocation.Name = newName Then Throw New Exception("The name is same as a project location's name, please change one.") End If Next Return currentLocation.Duplicate(newName) End Function
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also