revit二次开发水管创建

        /// <summary>
        /// 创建管道
        /// </summary>
        /// <returns></returns>
        public Pipe createPipe()
        {
            //过滤管道类型
            FilteredElementCollector collector1 = new FilteredElementCollector(document);
            List<PipeType> pipeTypes = collector1.OfClass(typeof(PipeType)).Cast<PipeType>().ToList();

            PipeType pipeType = null;


            foreach (PipeType item in pipeTypes)
            {
                if ("塑料管".Contains(item.Name))
                {
                    pipeType = item;
                    break;
                }
            }

            //过滤管道系统类型
            FilteredElementCollector collector2 = new FilteredElementCollector(document);
            List<PipingSystemType> pipingSystems = collector2.OfClass(typeof(PipingSystemType)).Cast<PipingSystemType>().ToList();

            PipingSystemType pipingSystem = null;
            foreach (PipingSystemType item in pipingSystems)
            {
                if ("家用冷水".Equals(item.Name))
                {
                    pipingSystem = item;
                    break;
                }
            }
            //标高
            View view = document.ActiveView;
            Level level = view.GenLevel;
            //点
            XYZ xyz1 = uIDocument.Selection.PickPoint();
            XYZ xyz2 = uIDocument.Selection.PickPoint();

            //创建
            Pipe pipe = Pipe.Create(document, pipingSystem.Id, pipeType.Id, level.Id, xyz1, xyz2);
            //修改偏移量
            pipe.get_Parameter(BuiltInParameter.RBS_OFFSET_PARAM).Set(ToFoot(1800.0));
            //修改直径
            pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(ToFoot(180.0));
            return pipe;
        }
        /// <summary>
        /// 毫米转英尺
        /// </summary>
        /// <param name="var">毫米</param>
        /// <returns>英尺</returns>
        public double ToFoot(double var)
        {
            double foot = UnitUtils.ConvertToInternalUnits(var, DisplayUnitType.DUT_MILLIMETERS);
            return foot;

        }

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周杰伦fans

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值