示例#1
0
        public static IEnumerable <T> CollectAllElementsOfClass <T>(GCRevitDocument doc, Type type, IsElement IsElem, CreateElement <T> CreateElement)
        {
            var coll = new FilteredElementCollector(doc.Document).OfClass(type);

            foreach (var el in coll.ToElements())
            {
                if (IsElem(el))
                {
                    yield return(CreateElement(el));
                }
            }
        }
示例#2
0
 public static IEnumerable <T> CollectSelectedElements <T>(GCRevitDocument doc, IsElement IsElem, CreateElement <T> CreateElement)
 {
     foreach (var id in doc.UIDocument.Selection.GetElementIds())
     {
         var el = doc.Document.GetElement(id);
         if (IsElem(el))
         {
             yield return(CreateElement(el));
         }
     }
 }
示例#3
0
        public static IEnumerable <T> CollectAllElementsOfCategory <T>(GCRevitDocument doc, BuiltInCategory categ, IsElement IsElem, CreateElement <T> CreateElement)
        {
            var coll = new FilteredElementCollector(doc.Document).OfCategory(categ);

            foreach (var el in coll.ToElements())
            {
                if (IsElem(el))
                {
                    yield return(CreateElement(el));
                }
            }
        }