public Result setup_stairs() { // https://help.autodesk.com/cloudhelp/2018/ENU/Revit-API/Revit_API_Developers_Guide/Revit_Geometric_Elements/Stairs_and_Railings/Creating_and_Editing_Stairs.html XYZ stairsline = new XYZ(146 / 12.0, 165 / 12.0, level.Elevation); ElementId newStairsId = null; using (StairsEditScope newStairsScope = new StairsEditScope(doc, "New Stairs")) { newStairsId = newStairsScope.Start(level.Id, level_above.Id); using (Transaction t = new Transaction(doc)) { t.Start("Create window"); Line locationLine = Line.CreateBound( stairsline, stairsline.Add(new XYZ(15, 0, 0))); StairsRun newRun2 = StairsRun.CreateStraightRun(doc, newStairsId, locationLine, StairsRunJustification.Center); // newRun2.ActualRunWidth = 10; t.Commit(); } newStairsScope.Commit(new MyRevit.StairsFailurePreprocessor()); } return(Result.Succeeded); }
/// <summary> /// Implements the interface method. /// </summary> public Autodesk.Revit.DB.Architecture.StairsRun CreateStairsRun(Document document, ElementId stairsId) { m_stairsRun = StairsRun.CreateStraightRun(document, stairsId, Transform(GetRunStairsPath()), StairsRunJustification.Center); Width = m_width; document.Regenerate(); // to get updated width return(m_stairsRun); }