Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
I am trying to get FamilySymbols and FamilyInstances of the same category. Here is my code:
ElementId targetCategoryId = elementList.ElementAt(0).Category.Id;
FilteredElementCollector collection = new FilteredElementCollector(doc);
ElementCategoryFilter filterCategory = new ElementCategoryFilter(targetCategoryId);
IList<Element> allFamilyInstances = collection.WherePasses(filterCategory).WhereElementIsNotElementType().ToElements();
IList<Element> targetFamilySymbols = collection.WherePasses(filterCategory).WhereElementIsElementType().ToElements();
The problem is the list allFamilyInstaces give me exactly what I want but targetFamilySymbols list gives me zero item.
When I move the line of code
IList<Element> targetFamilySymbols = collection.WherePasses(filterCategory).WhereElementIsElementType().ToElements();
to before the allFamilyInstances list. The result is vice versa, targetFamilySymbols gives all family symbols but allFamilyInstaces gives me none.
Can someone explain for me why? And how can I deal with this? Thank you
Solved! Go to Solution.