LocationPoint Class


Provides location functionality for all elements that have a single insertion point.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)

Syntax

C#
public class LocationPoint : Location
Visual Basic
Public Class LocationPoint _
	Inherits Location
Visual C++
public ref class LocationPoint : public Location

Remarks

The location point objects adds additional functionality to its base location object class. This includes setting the elements location to a specific point and retrieving its rotation around its insertion point. Inplace families do not have a single insertion point and therefore do not have meaningful LocationPoint data.

Examples

Copy C#
void LocationInformation(LocationPoint position)
{
    String prompt = "The selected column location information:";
    prompt += "\nPoint:  (" + position.Point.X + ", "
            + position.Point.Y + ", " + position.Point.Z + ")";
    prompt += "\nRotation: " + position.Rotation;

    TaskDialog.Show("Revit",prompt);
}

bool LocationRotate(Autodesk.Revit.ApplicationServices.Application application, Autodesk.Revit.DB.Element element)
{
    bool rotated = false;
    LocationPoint location = element.Location as LocationPoint;

    if (null != location)
    {
        XYZ aa = location.Point;
        XYZ cc = new XYZ(aa.X, aa.Y, aa.Z + 10);
        Line axis = Line.CreateBound(aa,cc);
        rotated = location.Rotate(axis, Math.PI / 2.0);
    }

    return rotated;
}
Copy VB.NET
Private Sub LocationInformation(position As LocationPoint)
    Dim prompt As [String] = "The selected column location information:"
    prompt += vbLf & "Point:  (" & Convert.ToString(position.Point.X) & ", " & Convert.ToString(position.Point.Y) & ", " & Convert.ToString(position.Point.Z) & ")"
    prompt += vbLf & "Rotation: " & Convert.ToString(position.Rotation)

    TaskDialog.Show("Revit", prompt)
End Sub

Private Function LocationRotate(application As Autodesk.Revit.ApplicationServices.Application, element As Autodesk.Revit.DB.Element) As Boolean
    Dim rotated As Boolean = False
    Dim location As LocationPoint = TryCast(element.Location, LocationPoint)

    If location IsNot Nothing Then
        Dim aa As XYZ = location.Point
        Dim cc As New XYZ(aa.X, aa.Y, aa.Z + 10)
        Dim axis As Line = Line.CreateBound(aa, cc)
        rotated = location.Rotate(axis, Math.PI / 2.0)
    End If

    Return rotated
End Function

Inheritance Hierarchy

System Object
Autodesk.Revit.DB APIObject
Autodesk.Revit.DB Location
Autodesk.Revit.DB LocationPoint

See Also