Revit中没有分割墙体的直接方法,一般采用调整原墙体的长度,再复制自身,调整复制体的长度。话不多说,直接上代码
public static void WallCopy(Document doc, XYZ sp, XYZ ep, Element wall) { XYZ origin = sp; List<ElementId> wallcopiesID = new List<ElementId>(); wallcopiesID = ElementTransformUtils.CopyElement(doc, wall.Id, origin) as List<ElementId>; Wall wallcopy = doc.GetElement(wallcopiesID[0]) as Wall; var newCurve = Line.CreateBound(sp, ep) as Curve; (wallcopy.Location as LocationCurve).Curve = newCurve; }