Rveit二次开发之创建墙饰条和过滤对应轮廓族

Reference refer = uidoc.Selection.PickObject(ObjectType.Element, "");

            Wall wall = doc.GetElement(refer) as Wall;

 

            //IList list = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Cornices).ToElements();

            //ElementType type = list[0] as ElementType;

 

            using (Transaction transaction = new Transaction(doc, "BIM"))

            {

                transaction.Start();

                Material mate = new FilteredElementCollector(doc).OfClass(typeof(Material)).Where(o => o.Name == "涂料 - 黄色").First() as Material;

                ElementType wallSweepType = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Cornices).WhereElementIsElementType().Cast().First();

                ElementType type = wallSweepType.Duplicate("墙3");

                WallSweepInfo wallSweepInfo = new WallSweepInfo(WallSweepType.Sweep, false);

                wallSweepInfo.WallSide = WallSide.Exterior;

                wallSweepInfo.Distance = 5;//距离墙的高度

                wallSweepInfo.WallOffset =0;//偏离墙的距离

                wallSweepInfo.CutsWall = true;

                foreach (Parameter o in type.Parameters)

                {

                    if (o.Definition.Name == "轮廓")

                    {

                        o.Set(FamilyUtils.GetProfileSymbols(doc, ProfileFamilyUsage.WallSweep, false).ElementAt(0));

                    }

                    if (o.Definition.Name == "材质")

                    {

                        o.Set(mate.Id);

                    }

 

                }

                WallSweep ws = WallSweep.Create(wall, type.Id, wallSweepInfo);

                transaction.Commit();

            }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值