List<string> stringParametersForComboBox4 = new List<string>
{
"OST_PipeAccessory",
"OST_Sprinklers",
"OST_MechanicalEquipment"
};
List<BuiltInCategory> catParametersForComboBox4 = new List<BuiltInCategory>
{
BuiltInCategory.OST_PipeAccessory,
BuiltInCategory.OST_Sprinklers,
BuiltInCategory.OST_MechanicalEquipment
};
foreach (string name in stringParametersForComboBox4)
{
comboBox4.Items.Insert(0, name);
}
private void button1_Click(object sender, EventArgs e)
{
FilteredElementCollector collector = new FilteredElementCollector(revitDoc);
// Здесь находишь номер выбранной в ComboBox категории - назовём её iCat
int iCat = comboBox4.SelectedIndex;
//ElementCategoryFilter filter = new ElementCategoryFilter(BuiltInCategory.OST_PipeAccessory);
ElementCategoryFilter filter = new ElementCategoryFilter(catParametersForComboBox4[iCat]);
//Applying Filter
IList<Element> ducts = collector.WherePasses(filter).WhereElementIsNotElementType().ToElements();