Beispiel #1
0
        /// <summary>
        /// Selects all elements of a type.  Works with documents other than the active document.
        /// </summary>
        /// <param name="type">The element type of the object, such as WallTypes or Walls.</param>
        /// <param name="inverted">If false, elements in the chosen category will be selected.  If true, elements NOT in the chosen category will be selected.</param>
        /// <param name="document">A Autodesk.Revit.DB.Document object.  This does not work with Dynamo document objects.</param>
        /// <returns name="Elements">A list of Dynamo elements that pass the filer.</returns>
        public static IList <DynElem> AllElementsOfType(Type type,
                                                        [DefaultArgument("false")] bool inverted,
                                                        [DefaultArgument("Synthetic.Revit.Document.Current()")] RevitDoc document)
        {
            SynthCollect collector = new SynthCollect(document);
            List <RevitDB.ElementFilter> filters = new List <Autodesk.Revit.DB.ElementFilter>();

            filters.Add(SynthCollectFilter.FilterElementClass(type, inverted));

            SynthCollect.SetFilters(collector, filters);

            return(SynthCollect.ToElements(collector));
        }
Beispiel #2
0
        /// <summary>
        /// Selects all Family Symbol types in a category, but excludes instances of those elements.  The node does not work with System familes because System Families do not have a Family Sybmol.
        /// </summary>
        /// <param name="category">The categoryId of the elements you wish to select.</param>
        /// <param name="inverted">If false, elements in the chosen category will be selected.  If true, elements NOT in the chosen category will be selected.</param>
        /// <param name="document">A Autodesk.Revit.DB.Document object.  This does not work with Dynamo document objects.</param>
        /// <returns name="Elements">A list of Dynamo elements that pass the filer.</returns>
        public static IList <DynElem> AllFamilyTypesOfCategory(DynCat category,
                                                               [DefaultArgument("false")] bool inverted,
                                                               [DefaultArgument("Synthetic.Revit.Document.Current()")] RevitDoc document)
        {
            SynthCollect collector = new SynthCollect(document);

            // Select only elements that are Family Symbols
            List <RevitDB.ElementFilter> filters = new List <Autodesk.Revit.DB.ElementFilter>();

            filters.Add(SynthCollectFilter.FilterElementClass(typeof(RevitDB.FamilySymbol), false));
            filters.Add(SynthCollectFilter.FilterElementCategory(category, inverted));

            SynthCollect.SetFilters(collector, filters);

            return(SynthCollect.ToElements(collector));
        }
Beispiel #3
0
        /// <summary>
        /// Selects all instance elements in a category, excludes element types.
        /// </summary>
        /// <param name="category">The categoryId of the elements you wish to select.</param>
        /// <param name="inverted">If false, elements in the chosen category will be selected.  If true, elements NOT in the chosen category will be selected.</param>
        /// <param name="document">A Autodesk.Revit.DB.Document object.  This does not work with Dynamo document objects.</param>
        /// <returns name="Elements">A list of Dynamo elements that pass the filer.</returns>
        public static IList <DynElem> AllElementsOfCategory(DynCat category,
                                                            [DefaultArgument("false")] bool inverted,
                                                            [DefaultArgument("Synthetic.Revit.Document.Current()")] RevitDoc document)
        {
            SynthCollect collector = new SynthCollect(document);

            // Select only elements that are NOT Types (the filter is inverted)
            List <RevitDB.ElementFilter> filters = new List <Autodesk.Revit.DB.ElementFilter>();

            filters.Add(SynthCollectFilter.FilterElementIsElementType(true));
            filters.Add(SynthCollectFilter.FilterElementCategory(category, inverted));

            SynthCollect.SetFilters(collector, filters);

            return(SynthCollect.ToElements(collector));
        }