Revit二次开发--逻辑或过滤器的使用
作者:互联网
今天做嵌套族实例的筛选时,对“常规模型”和“机械设备”均做提取,用到了逻辑或过滤器:
主要代码如下:
Document familyDoc = doc.EditFamily(family);
//筛选嵌套族文档中的嵌套实例
FilteredElementCollector collector = new FilteredElementCollector(familyDoc);
ElementCategoryFilter filter1 = new ElementCategoryFilter(BuiltInCategory.OST_GenericModel);
ElementCategoryFilter filter2 = new ElementCategoryFilter(BuiltInCategory.OST_MechanicalEquipment);
LogicalOrFilter orFilter = new LogicalOrFilter(filter1, filter2);
collector.OfClass(typeof(FamilyInstance)).WherePasses(orFilter);
foreach (Element elem in collector.ToElements())
{
comboBox1.Items.Add(elem.Name);
}
标签:FilteredElementCollector,嵌套,OST,过滤器,ElementCategoryFilter,二次开发,new,collector,Rev 来源: https://blog.csdn.net/qq_43026206/article/details/100662201