ProjectLocation.Duplicate
Description:
Generate a copy of this project location with the specified name.
Generate a copy of this project location with the specified name.
Remarks:
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.
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 Duplicate(
string name
)
-
Stringname
Return Value
ProjectLocation
A new ProjectLocation which is a duplicate of this location, with
the input name.
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);
}
-
A non-optional argument was null