//filter method for structural elements
        public static LogicalOrFilter GetStructuralFilter()
        {
            //columns, beams and foundations are family instances and not types unlike walls, floor,
            //ceiling, point load, continuoue footing, area load or line load.
            //so a logical filter is created to filter out all required structural elements

            BuiltInCategory[] builtInCategories = new BuiltInCategory[] { BuiltInCategory.OST_StructuralFraming };

            IList <ElementFilter> listOfElementFilter = new List <ElementFilter>(builtInCategories.Count());

            foreach (BuiltInCategory builtInCategory in builtInCategories)
            {
                listOfElementFilter.Add(new ElementCategoryFilter(builtInCategory));
            }

            LogicalOrFilter categoryFilter = new LogicalOrFilter(listOfElementFilter);

            LogicalAndFilter familyInstanceFilter = new LogicalAndFilter(categoryFilter, new ElementClassFilter(typeof(FamilyInstance)));

            IList <ElementFilter> typeFilter = new List <ElementFilter>();

            typeFilter.Add(new ElementClassFilter(typeof(Floor)));

            typeFilter.Add(new ElementClassFilter(typeof(Ceiling)));

            typeFilter.Add(familyInstanceFilter);

            LogicalOrFilter classFilter = new LogicalOrFilter(typeFilter);

            return(classFilter);
        }
Esempio n. 2
0
        public static LogicalOrFilter FamSymbolsAndPipeTypes()
        {
            BuiltInCategory[] bics = new BuiltInCategory[]
            {
                BuiltInCategory.OST_PipeAccessory,
                BuiltInCategory.OST_PipeCurves,
                BuiltInCategory.OST_PipeFitting,
            };

            IList <ElementFilter> a = new List <ElementFilter>(bics.Count());

            foreach (BuiltInCategory bic in bics)
            {
                a.Add(new ElementCategoryFilter(bic));
            }

            LogicalOrFilter categoryFilter = new LogicalOrFilter(a);

            LogicalAndFilter familySymbolFilter = new LogicalAndFilter(categoryFilter,
                                                                       new ElementClassFilter(typeof(FamilySymbol)));

            IList <ElementFilter> b = new List <ElementFilter>();

            b.Add(new ElementClassFilter(typeof(PipeType)));

            b.Add(familySymbolFilter);

            LogicalOrFilter classFilter = new LogicalOrFilter(b);

            return(classFilter);
        }
Esempio n. 3
0
        public static LogicalOrFilter FamInstOfDetailComp()
        {
            BuiltInCategory[] bics = new BuiltInCategory[]
            {
                BuiltInCategory.OST_DetailComponents,
            };

            IList <ElementFilter> a = new List <ElementFilter>(bics.Count());

            foreach (BuiltInCategory bic in bics)
            {
                a.Add(new ElementCategoryFilter(bic));
            }

            LogicalOrFilter categoryFilter = new LogicalOrFilter(a);

            LogicalAndFilter familySymbolFilter = new LogicalAndFilter(categoryFilter,
                                                                       new ElementClassFilter(typeof(FamilyInstance)));

            IList <ElementFilter> b = new List <ElementFilter>
            {
                familySymbolFilter
            };
            LogicalOrFilter classFilter = new LogicalOrFilter(b);

            return(classFilter);
        }
Esempio n. 4
0
        public static FilteredElementCollector GetElementsWithConnectors(Document doc)
        {
            // what categories of family instances
            // are we interested in?
            // From here: http://thebuildingcoder.typepad.com/blog/2010/06/retrieve-mep-elements-and-connectors.html

            BuiltInCategory[] bics = new BuiltInCategory[]
            {
                //BuiltInCategory.OST_CableTray,
                //BuiltInCategory.OST_CableTrayFitting,
                //BuiltInCategory.OST_Conduit,
                //BuiltInCategory.OST_ConduitFitting,
                //BuiltInCategory.OST_DuctCurves,
                //BuiltInCategory.OST_DuctFitting,
                //BuiltInCategory.OST_DuctTerminal,
                //BuiltInCategory.OST_ElectricalEquipment,
                //BuiltInCategory.OST_ElectricalFixtures,
                //BuiltInCategory.OST_LightingDevices,
                //BuiltInCategory.OST_LightingFixtures,
                //BuiltInCategory.OST_MechanicalEquipment,
                BuiltInCategory.OST_PipeAccessory,
                BuiltInCategory.OST_PipeCurves,
                BuiltInCategory.OST_PipeFitting,
                //BuiltInCategory.OST_PlumbingFixtures,
                //BuiltInCategory.OST_SpecialityEquipment,
                //BuiltInCategory.OST_Sprinklers,
                //BuiltInCategory.OST_Wire
            };

            IList <ElementFilter> a = new List <ElementFilter>(bics.Count());

            foreach (BuiltInCategory bic in bics)
            {
                a.Add(new ElementCategoryFilter(bic));
            }

            LogicalOrFilter categoryFilter = new LogicalOrFilter(a);

            LogicalAndFilter familyInstanceFilter = new LogicalAndFilter(categoryFilter, new ElementClassFilter(typeof(FamilyInstance)));

            //IList<ElementFilter> b = new List<ElementFilter>(6);
            IList <ElementFilter> b = new List <ElementFilter>();

            //b.Add(new ElementClassFilter(typeof(CableTray)));
            //b.Add(new ElementClassFilter(typeof(Conduit)));
            //b.Add(new ElementClassFilter(typeof(Duct)));
            b.Add(new ElementClassFilter(typeof(Pipe)));

            b.Add(familyInstanceFilter);

            LogicalOrFilter classFilter = new LogicalOrFilter(b);

            FilteredElementCollector collector = new FilteredElementCollector(doc);

            collector.WherePasses(classFilter);

            return(collector);
        }
Esempio n. 5
0
        FilteredElementCollector GetStructuralElements(Document doc)
        {
            // what categories of family instances
            // are we interested in?
            BuiltInCategory[] bics = new BuiltInCategory[] { BuiltInCategory.OST_StructuralFraming };

            IList <ElementFilter> a
                = new List <ElementFilter>(bics.Count());

            foreach (BuiltInCategory bic in bics)
            {
                a.Add(new ElementCategoryFilter(bic));
            }

            LogicalOrFilter categoryFilter
                = new LogicalOrFilter(a);

            LogicalAndFilter familyInstanceFilter
                = new LogicalAndFilter(categoryFilter,
                                       new ElementClassFilter(
                                           typeof(FamilyInstance)));

            IList <ElementFilter> b
                = new List <ElementFilter>(6)
                {
                familyInstanceFilter
                };

            LogicalOrFilter classFilter
                = new LogicalOrFilter(b);

            FilteredElementCollector collector
                = new FilteredElementCollector(doc);

            collector.WherePasses(classFilter);

            return(collector);
        }
Esempio n. 6
0
        //I was having trouble with FilteredELementCollector to
        //retrieve "Conduit Fittings", so a got this code that worked for me.
        //--------------------------------------------------------------------
        //Returns a FilteredElementCollector with the connector elements
        //https://thebuildingcoder.typepad.com/blog/2010/06/retrieve-mep-elements-and-connectors.html
        //Jeremy Tammik
        static FilteredElementCollector GetConnectorElements(
            Document doc,
            bool include_wires)
        {
            // what categories of family instances
            // are we interested in?

            BuiltInCategory[] bics = new BuiltInCategory[] {
                //BuiltInCategory.OST_CableTray,
                //BuiltInCategory.OST_CableTrayFitting,
                BuiltInCategory.OST_Conduit,
                BuiltInCategory.OST_ConduitFitting,
                //BuiltInCategory.OST_DuctCurves,
                //BuiltInCategory.OST_DuctFitting,
                //BuiltInCategory.OST_DuctTerminal,
                //BuiltInCategory.OST_ElectricalEquipment,
                //BuiltInCategory.OST_ElectricalFixtures,
                //BuiltInCategory.OST_LightingDevices,
                //BuiltInCategory.OST_LightingFixtures,
                //BuiltInCategory.OST_MechanicalEquipment,
                //BuiltInCategory.OST_PipeCurves,
                //BuiltInCategory.OST_PipeFitting,
                //BuiltInCategory.OST_PlumbingFixtures,
                //BuiltInCategory.OST_SpecialityEquipment,
                //BuiltInCategory.OST_Sprinklers,
                //BuiltInCategory.OST_Wire,
            };

            IList <ElementFilter> a
                = new List <ElementFilter>(bics.Count());

            foreach (BuiltInCategory bic in bics)
            {
                a.Add(new ElementCategoryFilter(bic));
            }

            LogicalOrFilter categoryFilter
                = new LogicalOrFilter(a);

            LogicalAndFilter familyInstanceFilter
                = new LogicalAndFilter(categoryFilter,
                                       new ElementClassFilter(
                                           typeof(FamilyInstance)));

            IList <ElementFilter> b
                = new List <ElementFilter>(6);

            b.Add(new ElementClassFilter(typeof(CableTray)));
            b.Add(new ElementClassFilter(typeof(Conduit)));
            b.Add(new ElementClassFilter(typeof(Duct)));
            b.Add(new ElementClassFilter(typeof(Pipe)));

            if (include_wires)
            {
                b.Add(new ElementClassFilter(typeof(Wire)));
            }

            b.Add(familyInstanceFilter);

            LogicalOrFilter classFilter
                = new LogicalOrFilter(b);

            FilteredElementCollector collector
                = new FilteredElementCollector(doc);

            collector.WherePasses(classFilter);

            return(collector);
        }
Esempio n. 7
0
        FilteredElementCollector GetStructuralElements(
            Document doc)
        {
            // what categories of family instances
            // are we interested in?

            BuiltInCategory[] bics = new BuiltInCategory[] {
                BuiltInCategory.OST_StructuralColumns,
                BuiltInCategory.OST_StructuralFraming,
                BuiltInCategory.OST_StructuralFoundation
            };

            IList <ElementFilter> a
                = new List <ElementFilter>(bics.Count());

            foreach (BuiltInCategory bic in bics)
            {
                a.Add(new ElementCategoryFilter(bic));
            }

            LogicalOrFilter categoryFilter
                = new LogicalOrFilter(a);

            LogicalAndFilter familyInstanceFilter
                = new LogicalAndFilter(categoryFilter,
                                       new ElementClassFilter(
                                           typeof(FamilyInstance)));

            IList <ElementFilter> b
                = new List <ElementFilter>(6);

            b.Add(new ElementClassFilter(
                      typeof(Wall)));

            b.Add(new ElementClassFilter(
                      typeof(Floor)));

            //b.Add(new ElementClassFilter(
            //    typeof(ContFooting)));

            b.Add(new ElementClassFilter(
                      typeof(PointLoad)));

            b.Add(new ElementClassFilter(
                      typeof(LineLoad)));

            b.Add(new ElementClassFilter(
                      typeof(AreaLoad)));

            b.Add(familyInstanceFilter);

            LogicalOrFilter classFilter
                = new LogicalOrFilter(b);

            FilteredElementCollector collector
                = new FilteredElementCollector(doc);

            collector.WherePasses(classFilter);

            return(collector);
        }