Generate a copy of this project location with the specified name.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.484.0)
Syntax
Parameters
- name
- Type: System..::..String
The name to be assigned to the duplicated project location.
Return Value
If successful a duplicate of this project location object with the specified name.
Remarks
Examples
CopyC#
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);
}
CopyVB.NET
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
See Also