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); }