Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I want to get all generic families that contains for example "test" in the name and show this in a windowsform combobox so i can use it in a form to set parameters etc. My thought was to do this with a parameter filter. I came this far as shown below this post. But how do you add the filter to the GenericFamilySymbolList? i tried collector.WherePasses(filter); But i get no results in the combobox . Without the filter everything works and shows all the generic models. but i need only the ones with test in the name (as example)
. Anyone an idea what i'm missing?
IList<Element> GenericFamilySymbolList = new List<Element>(); FilteredElementCollector collector = new FilteredElementCollector(doc); ////// Get Family Category////// //GenericFamilySymbolList =collector.OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_GenericModel).ToElements(); collector.OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_GenericModel).ToElements(); ElementId id = new ElementId(BuiltInParameter.DATUM_TEXT); ParameterValueProvider provider = new ParameterValueProvider(id); FilterStringRuleEvaluator evaluator = new FilterStringContains(); FilterRule rule = new FilterStringRule(provider, evaluator, "test", true); ElementParameterFilter filter = new ElementParameterFilter(rule); GenericModelComboBox form = new GenericModelComboBox(GenericFamilySymbolList); form.ShowDialog();
Solved! Go to Solution.