private void CollectSystemFamilies() { string typeName = ""; try { FilteredElementCollector collector = new FilteredElementCollector(doc); List <ElementFilter> filterList = new List <ElementFilter>(); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Ceilings)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Floors)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_GenericModel)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_StairsRailing)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Ramps)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Roofs)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Stairs)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_StructuralFoundation)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Walls)); LogicalOrFilter orFilter = new LogicalOrFilter(filterList); List <Element> elementTypes = collector.OfClass(typeof(ElementType)).WherePasses(orFilter).ToList <Element>(); if (elementTypes.Count > 0) { foreach (Element element in elementTypes) { ElementType elementType = element as ElementType; typeName = elementType.Name; if (null != elementType) { ElementTypeProperties etp = new ElementTypeProperties(elementType); string categoryName = etp.CategoryName; if (elementDictionary.ContainsKey(categoryName)) { if (!elementDictionary[categoryName].ContainsKey(etp.TypeID)) { elementDictionary[categoryName].Add(etp.TypeID, etp); } } else { elementDictionary.Add(categoryName, new Dictionary <int, ElementTypeProperties>()); elementDictionary[categoryName].Add(etp.TypeID, etp); } } } } } catch (Exception ex) { MessageBox.Show("Failed to collect SystemFamilies: " + typeName + "\n" + ex.Message, "ElementDataCollector Error:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void CollectFamilySymbols2() { try { FilteredElementCollector collector = new FilteredElementCollector(doc); List <ElementFilter> filterList = new List <ElementFilter>(); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_DetailComponents)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Fluids)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_ModelText)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_GenericAnnotation)); LogicalOrFilter orFilter = new LogicalOrFilter(filterList); ICollection <ElementId> excludes = collector.OfClass(typeof(ElementType)).WherePasses(orFilter).ToElementIds(); ExclusionFilter excFilter = new ExclusionFilter(excludes); collector = new FilteredElementCollector(doc); collector = collector.OfClass(typeof(FamilySymbol)).WherePasses(excFilter); var query = from element in collector where !element.Category.Name.Contains("Tag") && element.Parameters.Size > 0 orderby element.Category.Name select element; List <Element> famSymbols = query.ToList <Element>(); if (famSymbols.Count > 0) { foreach (Element element in famSymbols) { ElementType elementType = element as ElementType; if (null != elementType) { ElementTypeProperties etp = new ElementTypeProperties(elementType); string categoryName = etp.CategoryName; if (elementDictionary.ContainsKey(categoryName)) { elementDictionary[categoryName].Add(etp.TypeID, etp); } else { elementDictionary.Add(categoryName, new Dictionary <int, ElementTypeProperties>()); elementDictionary[categoryName].Add(etp.TypeID, etp); } } } } } catch (Exception ex) { MessageBox.Show("Failed to collect FamilySymbols: \n" + ex.Message, "ElementDataCollector Error:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void CollectFamilySymbols1() { try { FilteredElementCollector collector = new FilteredElementCollector(doc); List <ElementFilter> filterList = new List <ElementFilter>(); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Ceilings)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_CurtainWallPanels)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Doors)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Floors)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Furniture)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_FurnitureSystems)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_GenericModel)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Mass)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_SpecialityEquipment)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Stairs)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_StructuralFoundation)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Windows)); filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Walls)); LogicalOrFilter orFilter = new LogicalOrFilter(filterList); List <Element> famSymbols = collector.OfClass(typeof(FamilySymbol)).WherePasses(orFilter).ToList <Element>(); if (famSymbols.Count > 0) { foreach (Element element in famSymbols) { ElementType elementType = element as ElementType; if (null != elementType) { ElementTypeProperties etp = new ElementTypeProperties(elementType); string categoryName = etp.CategoryName; if (elementDictionary.ContainsKey(categoryName)) { elementDictionary[categoryName].Add(etp.TypeID, etp); } else { elementDictionary.Add(categoryName, new Dictionary <int, ElementTypeProperties>()); elementDictionary[categoryName].Add(etp.TypeID, etp); } } } } } catch (Exception ex) { MessageBox.Show("Failed to collect FamilySymbols: \n" + ex.Message, "ElementDataCollector Error:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void CollectSelectedElementsData(List <ElementType> selTypes) { try { typeDictionary = new Dictionary <string, Dictionary <int, TypeProperties> >(); instanceDictionary = new Dictionary <string, Dictionary <int, InstanceProperties> >(); sysTypeDictionary = new Dictionary <string, Dictionary <int, ElementTypeProperties> >(); sysInstDictionary = new Dictionary <string, Dictionary <int, ElementProperties> >(); viewTypeDictionary = new Dictionary <int, ViewTypeProperties>(); viewInstDictionary = new Dictionary <int, ViewProperties>(); if (selTypes.Count > 0) { foreach (ElementType atype in selTypes) { progressBar.PerformStep(); FamilySymbol famSymbol = atype as FamilySymbol; ViewFamilyType viewFamilyType = atype as ViewFamilyType; if (null != famSymbol) { TypeProperties tp = new TypeProperties(famSymbol); AddParameterInfo(tp.TypeParameters); if (typeDictionary.ContainsKey(tp.CategoryName)) { typeDictionary[tp.CategoryName].Add(tp.TypeID, tp); } else { typeDictionary.Add(tp.CategoryName, new Dictionary <int, TypeProperties>()); typeDictionary[tp.CategoryName].Add(tp.TypeID, tp); } StoreDataOfFamilySymbol(famSymbol); } else if (null != viewFamilyType) { ViewTypeProperties vtp = new ViewTypeProperties(viewFamilyType); AddParameterInfo(vtp.ViewTypeParameters); if (!viewTypeDictionary.ContainsKey(vtp.ViewTypeID)) { viewTypeDictionary.Add(vtp.ViewTypeID, vtp); StoreDataOfViewType(viewFamilyType); } } else //system family { ElementTypeProperties etp = new ElementTypeProperties(atype); AddParameterInfo(etp.ElementTypeParameters); if (sysTypeDictionary.ContainsKey(etp.CategoryName)) { sysTypeDictionary[etp.CategoryName].Add(etp.TypeID, etp); } else { sysTypeDictionary.Add(etp.CategoryName, new Dictionary <int, ElementTypeProperties>()); sysTypeDictionary[etp.CategoryName].Add(etp.TypeID, etp); } StoreDataOfElementType(atype); } } } CollectFamilyNames(); } catch (Exception ex) { MessageBox.Show("Failed to collect selected Elements Data: \n" + ex.Message, "ElementDataCollector Error:", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }