【问题标题】:Select category of elements选择元素类别
【发布时间】:2021-10-11 04:56:15
【问题描述】:

插件组合了属于某个类别的元素的选定参数。插件中没有内置类别,如何让用户选择一个?

01

02

List<string> stringParametersForComboBox4 = new List<string>

        {

            "OST_PipeAccessory",
            "OST_Sprinklers",
            "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);
         ElementCategoryFilter filter = new ElementCategoryFilter(BuiltInCategory.OST_PipeAccessory);
        //Applying Filter
        IList<Element> ducts = collector.WherePasses(filter).WhereElementIsNotElementType().ToElements();

【问题讨论】:

    标签: c# plugins combobox concatenation revit-api


    【解决方案1】:

    这将为您提供模型中所有类别的下拉列表供您选择:

    foreach (Category cat in revitDoc.Settings.Categories)
    {
        comboBox1.Items.Insert(0, cat.Name);
    }
    

    enter image description here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-05
      • 2017-01-19
      • 2021-12-28
      • 1970-01-01
      • 1970-01-01
      • 2010-11-09
      • 1970-01-01
      • 2018-05-21
      相关资源
      最近更新 更多