예제 #1
0
파일: Ac.cs 프로젝트: 15831944/Geo7
        public static SortedSet <string> GetBlockNames(bool onlyWithReferences, bool onlyWithAttributes)
        {
            var res = new SortedSet <string>();

            using (var trans = Ac.StartTransaction())
            {
                var dbBlocks = trans.BlockDefs.AsEnumerable();
                if (onlyWithReferences)
                {
                    dbBlocks = dbBlocks.Where(b => b.HasReferences);
                }
                if (onlyWithAttributes)
                {
                    dbBlocks = dbBlocks.Where(b => b.HasAttributes);
                }

                res.AddItems(dbBlocks.Select(b => b.Name));
            }
            return(res);
        }