C3D-0581 · List non-C- layers with objects done
Read-only: every layer not starting C- that has top-level entities in model or any layout, with counts by type.
C# payload
var bt=(BlockTable)Tx.GetObject(Db.BlockTableId,OpenMode.ForRead);
var map=new SortedDictionary<string,SortedDictionary<string,int>>(StringComparer.OrdinalIgnoreCase);
foreach(ObjectId sid in bt){
var sp=(BlockTableRecord)Tx.GetObject(sid,OpenMode.ForRead);
if(!sp.IsLayout) continue;
foreach(ObjectId id in sp){
var en=Tx.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if(en==null) continue;
if(en.Layer.StartsWith("C-",StringComparison.OrdinalIgnoreCase)) continue;
if(!map.ContainsKey(en.Layer)) map[en.Layer]=new SortedDictionary<string,int>();
var t=en.GetType().Name; var d=map[en.Layer];
d[t]=d.ContainsKey(t)?d[t]+1:1;
}
}
foreach(var kv in map){
Log(kv.Key.PadRight(36)+" n="+kv.Value.Values.Sum().ToString().PadRight(6)+" ["+string.Join(" ",kv.Value.Select(x=>x.Key+":"+x.Value))+"]");
}
Log("layers="+map.Count);
Result
Log
0 n=132 [Circle:1 CogoPoint:125 Line:3 Viewport:3] BLOCK_CLOSURE n=33 [Arc:1 DBText:8 Line:12 MText:1 Polyline:4 Polyline2d:2 RasterImage:1 Solid:4] BLOCK_NORTH_ARROW n=202 [Arc:4 DBText:2 Line:180 Polyline2d:16] BLOCK_NOTES_FLOOD n=2 [MText:2] BLOCK_STAMP n=140 [Arc:4 Circle:4 DBText:112 Line:16 Polyline:4] BLOCK_TB2 n=100 [BlockReference:1 DBText:15 Line:77 MText:6 Viewport:1] BOUNDARY n=1 [Polyline:1] PTS n=18 [Circle:6 DBPoint:6 DBText:6] TB1 n=12 [Line:12] TEXT n=1 [MText:1] V-CTRL-HCPT n=1 [BlockReference:1] V-NODE-STRM n=2 [BlockReference:2] V-NODE-WATR n=2 [BlockReference:2] X-PROP-CRNR n=1 [Circle:1] layers=14
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.