Moves one element by a given transformation.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since:
2012
Syntax
Visual Basic |
---|
Public Shared Sub MoveElement ( _
document As Document, _
elementToMove As ElementId, _
translation As XYZ _
) |
Visual C++ |
---|
public:
static void MoveElement(
Document^ document,
ElementId^ elementToMove,
XYZ^ translation
) |
Examples
CopyC#
public void MoveColumn(Autodesk.Revit.DB.Document document, FamilyInstance column)
{
LocationPoint columnLocation = column.Location as LocationPoint;
XYZ oldPlace = columnLocation.Point;
XYZ newPlace = new XYZ(10, 20, 30);
ElementTransformUtils.MoveElement(document, column.Id, newPlace);
columnLocation = column.Location as LocationPoint;
XYZ newActual = columnLocation.Point;
string info = "Original Z location: " + oldPlace.Z +
"\nNew Z location: " + newActual.Z;
TaskDialog.Show("Revit",info);
}
CopyVB.NET
Public Sub MoveColumn(document As Autodesk.Revit.DB.Document, column As FamilyInstance)
Dim columnLocation As LocationPoint = TryCast(column.Location, LocationPoint)
Dim oldPlace As XYZ = columnLocation.Point
Dim newPlace As New XYZ(10, 20, 30)
ElementTransformUtils.MoveElement(document, column.Id, newPlace)
columnLocation = TryCast(column.Location, LocationPoint)
Dim newActual As XYZ = columnLocation.Point
Dim info As String = ("Original Z location: " + oldPlace.Z & vbLf & "New Z location: ") + newActual.Z
TaskDialog.Show("Revit", info)
End Sub
Exceptions
See Also