This property is used to find the physical location of an element within a project.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic virtual Location Location { get; }
Public Overridable ReadOnly Property Location As Location
Get
public:
virtual property Location^ Location {
Location^ get ();
}
abstract Location : Location with get
override Location : Location with get
Property Value
Location
RemarksThe 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.
Examplevoid GetLocationInformation(Autodesk.Revit.DB.Element element)
{
Autodesk.Revit.DB.Location position = element.Location;
String prompt = null;
if (null == position)
{
prompt = "No location can be found in element.";
}
else
{
Autodesk.Revit.DB.LocationPoint positionPoint = position as Autodesk.Revit.DB.LocationPoint;
if (null != positionPoint)
{
prompt = "Element has a point location.";
}
else
{
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);
}
}
Private Sub GetLocationInformation(element As Autodesk.Revit.DB.Element)
Dim position As Autodesk.Revit.DB.Location = element.Location
Dim prompt As [String] = Nothing
If position Is Nothing Then
prompt = "No location can be found in element."
Else
Dim positionPoint As Autodesk.Revit.DB.LocationPoint = TryCast(position, Autodesk.Revit.DB.LocationPoint)
If positionPoint IsNot Nothing Then
prompt = "Element has a point location."
Else
Dim positionCurve As Autodesk.Revit.DB.LocationCurve = TryCast(position, Autodesk.Revit.DB.LocationCurve)
If positionCurve IsNot Nothing Then
prompt = "Element has a curve location."
End If
End If
End If
If prompt IsNot Nothing Then
TaskDialog.Show("Revit", prompt)
End If
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also