Message 1 of 4
Find family elements by name parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to filter elements by the Name parameter using a FilterStringRule:
var elementParameter = new ParameterValueProvider(new ElementId(BuiltInParameter.?????));
var stringContains = new FilterStringContains();
var stringRule = new FilterStringRule(elementParameter, stringContains, "Mullion", false);
var mullionFilterOne = new FilteredElementCollector(doc)
.OfClass(typeof(Family))
.WherePasses(new ElementParameterFilter(stringRule));
But this yields no results...
I'm getting expected elements using this way instead, but it's potentially a much slower way of getting the elements:
var mullionFilterTwo = new FilteredElementCollector(doc)
.OfClass(typeof(Family))
.ToElements()
.Where(x => x.Name.ToLower().Contains("mullion"));
What am I doing wrong? I've tried many different BuiltInParameters but with no success. What BuiltInParameter do I need to check to get the Name parameter of a Family Element?
Thanks!