Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
what would be optimal way of retrieving Built In and Shared Parameters (if the Shared Parameter is not added as Project Parameter) for all FamilySymbols (Family) in Doors Category?
For now my approach is like this:
public static FilteredElementCollector FilterBuiltInElements(Document doc, Category selectedCategory)
{
// Filter out elements that are only for built in categories
// and where elements are Element Types NOT instances
BuiltInCategory builtInCategory = selectedCategory.BuiltInCategory; // Get built in category for selected category
var elementFilter = new ElementCategoryFilter(builtInCategory);
FilteredElementCollector elementCollection = new FilteredElementCollector(doc)
.WherePasses(elementFilter)
.WhereElementIsElementType();
return elementCollection;
}
public static List<Parameter> GetBuiltInAndSharedParametersForFamilyType(IEnumerable<Element> elements)
{
List<Parameter> elementParameters = elements
.First() // Get only the first element because all FamilySymbol elements are of the same category and therefore have the same FamilySymbol parameters
.GetOrderedParameters()
.Where(param => IsBuiltInParameter(param) || param.IsShared)
.ToList();
return elementParameters;
}
It works well if the Shared Parameter are added as Project Parameter to Door Category.
I could loop through all FamilySymbol elements and combine parameters, but maybe there is more elegant way of getting Shared Parameters for FamilySymbol ?
Solved! Go to Solution.