Revit API之StairsPath(楼梯路径)讲解

楼梯路径(StairsPath类)可用于注释楼梯的倾斜方向和行走线。 静态方法StairsPath.Create()将为指定楼梯创建一个新的楼梯路径,并在特定平面视图中指定楼梯路径类型,其中楼梯必须可见。

在Revit UI中编辑楼梯路径时,StairsPath类具有相关属性,例如用于设置向上和向下文本的属性或是否应显示文本。 另外,可以指定向上和向下文本的偏移量,以及从楼梯中心线到楼梯路径的偏移量。

以下示例在项目中查找StairsPathType和FloorPlan,并使用它们为给定的Stairs创建新的StairsPath。

private void CreateStairsPath(Document document, Stairs stairs)
{
    Transaction transNewPath = new Transaction(document, "New Stairs Path");
    transNewPath.Start();
            
    // Find StairsPathType
    FilteredElementCollector collector = new FilteredElementCollector(document);
    ICollection<ElementId> stairsPathIds = collector.OfClass(typeof(StairsPathType)).ToElementIdsElementId();

    // Find a FloorPlan
    ElementId planViewId = ElementId.InvalidElementId;
    FilteredElementCollector viewCollector = new FilteredElementCollector(document);
    ICollection<ElementId> viewIds = viewCollector.OfClass(typeof(View)).ToElementIdsElementId();
    foreach (ElementId viewId in viewIds)
    {
        View view = document.GetElement(viewId) as View;
        if (view.ViewType == ViewType.FloorPlan)
        {
            planViewId = view.Id;
            break;
        }
    }
            
    LinkElementId stairsLinkId = new LinkElementId(stairs.Id);
    StairsPath.Create(stairs.Document, stairsLinkId, stairsPathIds.First(), planViewId);
    transNewPath.Commit();
}

 

一个StairsPath有一个StairsPathType(楼梯路径类型)。 楼梯路径类型可从2个预定义系统系列中获得:自动向上/向下方向和固定向上方向。 这两种类型的属性同样可用作StairsPathType类中的属性,例如FullStepArrow和DistanceToCutMark。

CutMarkType类表示Revit UI中的剪切标记类型,它具有表示在UI中编辑剪切标记类型时可用的属性,例如CutLineAngle和CutLineExtension。 它与StairsType对象相关联,可以使用BuiltInParameter STAIRSTYPE_CUTMARK_TYPE进行检索,如下所示。

private CutMarkType GetCutMark(Stairs stairs)
{
    CutMarkType cutMarkType = null;
    StairsType stairsType = stairs.Document.GetElement(stairs.GetTypeId()) as StairsType;
    Parameter paramCutMark = stairsType.get_Parameter(BuiltInParameter.STAIRSTYPE_CUTMARK_TYPE);
    if (paramCutMark.StorageType == StorageType.ElementId)  // should be an element id
    {
        ElementId cutMarkId = paramCutMark.AsElementId();
        cutMarkType = stairs.Document.GetElement(cutMarkId) as CutMarkType;
    }

    return cutMarkType;
}

 

=========【更多高级应用请关注公众号】========

 

===================================

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值