0
点赞
收藏
分享

微信扫一扫

Revit查询元素的方法


FilteredElementCollector collector = new FilteredElementCollector(m_Doc);

            collector.OfCategory(BuiltInCategory.OST_MechanicalEquipmentTags);

collector.OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_MechanicalEquipment).ToElements();

FilteredElementCollector collector = new FilteredElementCollector(UiDoc.Document, UiDoc.Document.ActiveView.Id);
                    Outline outLine = new Outline(Min, Max);
                    BoundingBoxIntersectsFilter filter = new BoundingBoxIntersectsFilter(outLine, 0.001);
                    GetAllElement = collector.WherePasses(filter).ToElements().Where(ee => IsometricDrawingTools.CheckBoxOutLineGetElement(CurrSelectMepSys as PipingSystem, ee)).ToList();
                    isGetDone = GetAllNeedDrawElementData(GetAllElement);

            BoundingBoxIntersectsFilter intersectsFilter = new BoundingBoxIntersectsFilter(outLine);
            LogicalAndFilter andFilter = new LogicalAndFilter(intersectsFilter, elementFilter);
            FilteredElementCollector collector = new FilteredElementCollector(doc);
            List<Element> collection = collector.WherePasses(andFilter).ToElements().ToList();

            FilteredElementCollector collector = new FilteredElementCollector(doc, doc.ActiveView.Id);
            LogicalOrFilter orFilter = new LogicalOrFilter(GetElementFilter());
            double[] viewRange = RevitAPIUIOperate.GetViewRange2(doc.ActiveView);

        private IList<ElementFilter> GetElementFilter()
        {
            IList<ElementFilter> listFilter = new List<ElementFilter>();

            IList<BuiltInCategory> listBCategory = GetListCategory();

            foreach (var item in listBCategory)
            {
                ElementCategoryFilter ecf = new ElementCategoryFilter(item);
                listFilter.Add(ecf);
            }
            return listFilter;
        }

 private IList<BuiltInCategory> GetListCategory()
        {
            IList<BuiltInCategory> listBCategory = new List<BuiltInCategory>();
            listBCategory.Add(BuiltInCategory.OST_PipeCurves);
            listBCategory.Add(BuiltInCategory.OST_PipeFitting);
            listBCategory.Add(BuiltInCategory.OST_PipeAccessory);
            listBCategory.Add(BuiltInCategory.OST_DuctCurves);
            listBCategory.Add(BuiltInCategory.OST_DuctFitting);
            listBCategory.Add(BuiltInCategory.OST_DuctAccessory);
            listBCategory.Add(BuiltInCategory.OST_DuctTerminal);
            listBCategory.Add(BuiltInCategory.OST_PlumbingFixtures);
            listBCategory.Add(BuiltInCategory.OST_MechanicalEquipment);
            listBCategory.Add(BuiltInCategory.OST_Sprinklers);
            listBCategory.Add(BuiltInCategory.OST_PipeSchedules);
            listBCategory.Add(BuiltInCategory.OST_Walls);
            listBCategory.Add(BuiltInCategory.OST_Windows);
            listBCategory.Add(BuiltInCategory.OST_Doors);
            listBCategory.Add(BuiltInCategory.OST_Grids);
            listBCategory.Add(BuiltInCategory.OST_MechanicalEquipmentTags); //机械设备标注
            listBCategory.Add(BuiltInCategory.OST_PipeTags); //管道标记
            listBCategory.Add(BuiltInCategory.OST_DuctTags); // 风管标记
            listBCategory.Add(BuiltInCategory.OST_IOSDetailGroups);
            listBCategory.Add(BuiltInCategory.OST_Columns);
            listBCategory.Add(BuiltInCategory.OST_StructuralColumns);
            listBCategory.Add(BuiltInCategory.OST_RoomTags);
            return listBCategory;
        }

举报

相关推荐

0 条评论