欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

项目中所有的构件

程序员文章站 2022-04-29 20:30:18
...
var allEles = fecNonType.WhereElementIsNotElementType().Where(ele => ele.Category != null && ele.Category.CategoryType == CategoryType.Model && ele.Category.AllowsBoundParameters == true
      ).ToList();

      var allTs = (from ele in allEles
                   where ele.Category != null && ele.Category.CategoryType == CategoryType.Model && ele.Category.AllowsBoundParameters == true && ele.GetTypeId() != ElementId.InvalidElementId
                   select doc.GetElement(ele.GetTypeId()) as ElementType).Distinct(new EleTypeEqualityComparer());


      //FilteredElementCollector fec = new FilteredElementCollector(doc);

      //ElementClassFilter filter01 = new ElementClassFilter(typeof(HostObjAttributes));
      //ElementClassFilter filter02 = new ElementClassFilter(typeof(InsertableObject));
      //LogicalOrFilter orFilter = new LogicalOrFilter(filter01, filter02);

      ////项目中所有的族类型
      //var allTypes = fec.WherePasses(orFilter).Cast<ElementType>().ToList();

      var grpTypes = allTs.GroupBy(
        ele =>
              {
                if (ele.Category == null)
                {
                  return "NullCate";
                }
                else
                {
                  return ele.Category.Name;
                }
              }).ToList();