Wall wall = RevitDoc.GetElement(new ElementId(204884)) as Wall;
LocationCurve locationCurve = wall.Location as LocationCurve;
Line location = locationCurve.Curve as Line;
XYZ startPoint = location.GetEndPoint(0);
XYZ endPoint = location.GetEndPoint(1);
互为反向,由点生成墙
ElementId levelId = new ElementId(13071);
using (Transaction transaction = new Transaction(RevitDoc))
{
transaction.Start("Create wall");
XYZ startpoint = new XYZ(0, 0, 0);
XYZ endPoint = new XYZ(100, 0, 0);
Line line = Line.CreateBound(startpoint, endPoint);
Wall wall = Wall.Create(RevitDoc, line, levelId, false);
transaction.Commit();
}
注意:未考虑英尺与米之间转换问题。