1、Using Location
ElementId ElementId = new ElementId(470604); Element Element = doc.GetElement(ElementId); LocationPoint location = Element.Location as LocationPoint; XYZ newlocation = new XYZ(location.Point.X+10, location.Point.Y, location.Point.Z); location.Point = newlocation;
MOVE后加偏移量!
ElementId ElementId = new ElementId(470604); Element Element = doc.GetElement(ElementId); LocationPoint location = Element.Location as LocationPoint; XYZ newlocation1 = new XYZ(10,0,0); location.Move(newlocation1);
参考文献:http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-CD3B9A83-8DBC-418E-8099-D655AB3DA010
public void MoveColumn(Autodesk.Revit.DB.Document document, FamilyInstance column) { // get the column current location LocationPoint columnLocation = column.Location as LocationPoint; XYZ oldPlace = columnLocation.Point; // Move the column to new location. XYZ newPlace = new XYZ(10, 20, 30); ElementTransformUtils.MoveElement(document, column.Id, newPlace); // now get the column's new location 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); }