Duplicate Method


Project Location Duplicate Method

Generate a copy of this project location with the specified name.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntax
public ProjectLocation Duplicate(
	string name
)

Parameters

name String

Return Value

ProjectLocation
A new ProjectLocation which is a duplicate of this location, with the input name.
Exceptions
Exception Condition
ArgumentNullException A non-optional argument was null
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.
Example
C#
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);
}
See Also
ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →