前言
Revit 目前仅能创建组合楼梯,即所有楼梯都必须是梯段(Run)、平台(Landing)以及支撑(Support)组成。另外,栏杆扶手可以附着在它上面。
梯段 - Run
通过 API,可以创建直梯、螺旋楼梯、L或者U 形斜踏步梯段。前两者非常直接:
StairsRun
的静态方法:
public static StairsRun CreateSpiralRun(Document document, ElementId stairsId, XYZ center, double radius, double startAngle, double includedAngle, bool clockwise, StairsRunJustification justification);
public static StairsRun CreateStraightRun(Document document, ElementId stairsId, Line locationPath, StairsRunJustification justification);
L或者U 形斜踏步梯段,目前看来只能使用变通的方法,参考SDK中的 WinderStairs(需要再翻翻API文档),用 SketchRun 来代替:
public static StairsRun CreateSketchedRun(Document document, ElementId stairsId, double baseElevation, IList<Curve> boundaryCurves, IList<Curve> riserCurves, IList<Curve> stairsPath);
public static StairsRun CreateSketchedRunWithSlopeData(Document document, ElementId stairsId, double baseElevation, IList<SketchedStairsCurveData> boundaryCurves, IList<Curve> riserCurves, IList<Curve> stairsPath);
平台 - Landing
有两种创建平台构件的方式,通过拾取两个梯段创建平台构件或者通过绘制轮廓生成平台构件。
StairsLanding
拾取两个梯段创建平台构件相关的API:
public static bool CanCreateAutomaticLanding(Document document, ElementId firstRunId, ElementId secondRunId);
public static IList<ElementId> CreateAutomaticLanding(Document document, ElementId firstRunId, ElementId secondRunId);
StairsLanding
通过绘制轮廓生成平台构件相关的API:
public static StairsLanding CreateSketchedLanding(Document document, ElementId stairsId, CurveLoop curveLoop, double baseElevation);
public static StairsLanding CreateSketchedLandingWithSlopeData(Document document, ElementId stairsId, IList<SketchedStairsCurveData> curveLoop, double baseElevation);
支撑 - Support
Revit API 中没有针对于 Support 暴露类似 StairsSupport
的构件,它也不能队里创建,可以在梯段或者平台中进行设置。如果想要得到 Support 可以通过,StairsLanding.GetAllSupports
和 StairsRun.GetAllSupports
来获取与对应的平台或者 梯段相关联的支撑。也可通过它的类型Category来找到文档中的支撑,例如 OST_StairsStringerCarriage
。