....
when you create the collector you use ofClass that retrieve only the instance.
is that make sense ?
Don't you only want the instances?, only the OfCategory would return Instance and Types that's correct.
@amir.aroesti wrote:
FilteredElementCollector collector = new FilteredElementCollector(doc);
ElementCategoryFilter filter = new ElementCategoryFilter(BuiltInCategory.OST_Walls);
IList<Wall> walls = collector.WherePasses(filter).WhereElementIsNotElementType().Cast<Wall>().Where(w => w.WallType.Kind == WallKind.Basic).ToList();
in my original code there is no WhereElementIsNotElementType()
Be carefull with the code above, if you retrieve the elements by category also In-Place Model Walls will be retrieved and they are FamilyInstances, so the Cast to Wall will Fail, use the OfClass method to ignore them and then also no need for WhereElementIsNotElementType
Also ".WherePasses(filter). " can be replaced by the inline version: ".Ofcategory(<Bultincategory>)."
- Michel