Revit二次开发之标注矩形洞口的边

public void BackOpeningGeometry( Element elem,Document doc)

        {

            ReferenceArray array = new ReferenceArray();

            Options option =new Options();

            option.ComputeReferences = true;//允许 面 边 点 有效引用

            option.DetailLevel = ViewDetailLevel.Medium;//构件的详细程度

            option.IncludeNonVisibleObjects = true;//不可见的几何

            GeometryElement groElement = elem.get_Geometry(option);

            List(Line) list = new List(Line)();

            foreach (GeometryObject groObj in groElement)

            {

                if (groObj is Line)//非标准族实例

                {

 

                    Line line = groObj as Line;

                    list.Add(line);

                    

                }

              

            }

 

            list = list.Where(o => Math.Abs((o.GetEndPoint(0) - o.GetEndPoint(1)).Normalize().Z) != 1).OrderBy(o => o.GetEndPoint(0).Z).ToList();

 

            array.Append(list[4].GetEndPointReference(0));

            array.Append(list[6].GetEndPointReference(1));

 

            Line lines = Line.CreateBound(list[4].GetEndPoint(0),list[6].GetEndPoint(1));

            using (Transaction ts = new Transaction(doc, "del"))

            {

                ts.Start();

                doc.Create.NewDimension(doc.ActiveView, lines, array);                

                ts.Commit();

            }

         

            

        }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值