Namespace:
Autodesk.Revit.DB
Location
Class
Description:
Provides location functionality for all elements.
Provides location functionality for all elements.
Remarks:
The location object provides the ability to translate and rotate elements. More detailed location information and control can be found by using the derivatives of this object, such as LocationPoint or LocationCurve.
The location object provides the ability to translate and rotate elements. More detailed location information and control can be found by using the derivatives of this object, such as LocationPoint or LocationCurve.
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.Location
Autodesk.Revit.DB.LocationCurve
Autodesk.Revit.DB.LocationPoint
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.Location
Autodesk.Revit.DB.LocationCurve
Autodesk.Revit.DB.LocationPoint
Examples
void ShowLocationUsage(Autodesk.Revit.ApplicationServices.Application application, Wall wall)
{
// Get the location instance.
Autodesk.Revit.DB.Location position = wall.Location;
// Check whether the wall is pinned.
if (wall.Pinned)
{
throw new Exception("The wall has been pinned.");
}
// Move the wall location, it provides same function as Move method of Document class.
XYZ direction = new XYZ(10, 0, 0);
bool result = position.Move(direction);
if (!result)
{
throw new Exception("Move wall location failed.");
}
// Rotate the wall location, it provides same function as Rotate method of Document class.
XYZ axisStart = new XYZ(0, 0, 0);
XYZ axisEnd = new XYZ(0, 0, 1);
Line axis = Line.CreateUnbound(axisStart, axisEnd);
result = position.Rotate(axis, 30);
if (!result)
{
throw new Exception("Rotate wall location failed.");
}
}
Location Class Members:
Name | Description | Inherited From |
---|---|---|
IsReadOnly | Identifies if the object is read-only or modifiable. (Inherited from APIObject ) | APIObject |
Name | Description | Inherited From |
---|---|---|
Dispose | Causes the object to release immediately any resources it may be utilizing. (Inherited from APIObject ) | APIObject |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object ) | Object |
GetHashCode | Serves as the default hash function. (Inherited from Object ) | Object |
GetType | Gets the Type of the current instance. (Inherited from Object ) | Object |
Move | Move the element within the project by a specified vector. | |
Rotate | Rotate the element within the project by a specified angle around a given axis. | |
ToString | Returns a string that represents the current object. (Inherited from Object ) | Object |