Location Property


Element Location Property

This property is used to find the physical location of an element within a project.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public virtual Location Location { get; }

Property Value

Location
Remarks
The Location property returns an object that can be used to find the location of an object within the project. An object may have a point location, such as a table or may have a line location. A wall is an example of an element that has a line location.
Example
void GetLocationInformation(Autodesk.Revit.DB.Element element)
{
    // Get the Location property and judge whether it exists
    Autodesk.Revit.DB.Location position = element.Location;

    String prompt = null;
    if (null == position)
    {
        prompt = "No location can be found in element.";
    }
    else
    {
        // If the location is a point location, give the user information
        Autodesk.Revit.DB.LocationPoint positionPoint = position as Autodesk.Revit.DB.LocationPoint;
        if (null != positionPoint)
        {
            prompt = "Element has a point location.";
        }
        else
        {

            // If the location is a curve location, give the user information
            Autodesk.Revit.DB.LocationCurve positionCurve = position as Autodesk.Revit.DB.LocationCurve;
            if (null != positionCurve)
            {
                prompt = "Element has a curve location.";
            }
        }
    }

    if (null != prompt)
    {
        TaskDialog.Show("Revit",prompt);
    }
}
See Also
ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →