C3D-INS619 · Inspect 3625 Stonewall Tell Rd done
C# payload
// Read-only structure inspection of the active drawing (model space read explicitly).
Log($"Drawing: {Doc.Name}");
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
var layers = new Dictionary<string,int>();
var blocks = new Dictionary<string,int>();
int text=0, circles=0, lines=0, plines=0, arcs=0, tables=0, other=0, attBlocks=0;
var attDump = new List<string>();
foreach (ObjectId id in ms) {
var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null) continue;
layers[e.Layer] = layers.TryGetValue(e.Layer, out var lc) ? lc+1 : 1;
if (e is BlockReference br) {
var bn = ((BlockTableRecord)Tx.GetObject(br.IsDynamicBlock ? br.DynamicBlockTableRecord : br.BlockTableRecord, OpenMode.ForRead)).Name;
blocks[bn] = blocks.TryGetValue(bn, out var bc) ? bc+1 : 1;
if (br.AttributeCollection.Count > 0) {
attBlocks++;
attDump.Add($"{bn} (h{br.Handle}):");
foreach (ObjectId aid in br.AttributeCollection) { var a=(AttributeReference)Tx.GetObject(aid,OpenMode.ForRead); attDump.Add($" {a.Tag} = \"{a.TextString}\""); }
}
}
else if (e is MText || e is DBText) text++;
else if (e is Autodesk.AutoCAD.DatabaseServices.Table) tables++;
else if (e is Line) lines++;
else if (e is Polyline) plines++;
else if (e is Arc) arcs++;
else if (e is Circle) circles++;
else other++;
}
Log($"Model: blocks={blocks.Values.Sum()}, attribBlocks={attBlocks}, text={text}, lines={lines}, polylines={plines}, arcs={arcs}, circles={circles}, tables={tables}, other={other}");
Log($"-- Layers ({layers.Count}) top 25 --");
foreach (var kv in layers.OrderByDescending(k=>k.Value).Take(25)) Log($" {kv.Key}: {kv.Value}");
Log($"-- Blocks ({blocks.Count}) --");
foreach (var kv in blocks.OrderByDescending(k=>k.Value).Take(20)) Log($" {kv.Key}: {kv.Value}");
Log("-- Attributed blocks (title block etc.) --");
foreach (var l in attDump.Take(80)) Log(l);
// layouts / sheets
Log("-- Layouts (sheets) --");
var ld = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
var los = new List<Layout>();
foreach (DBDictionaryEntry de in ld) los.Add((Layout)Tx.GetObject(de.Value, OpenMode.ForRead));
foreach (var lo in los.OrderBy(l=>l.TabOrder)) { if (lo.LayoutName=="Model") continue; var ps=(BlockTableRecord)Tx.GetObject(lo.BlockTableRecordId,OpenMode.ForRead); int n=0; foreach(ObjectId x in ps) n++; Log($" [{lo.TabOrder}] '{lo.LayoutName}' ({n} ents)"); }
// Civil 3D objects
try {
var cd = CivilDoc;
Log("-- Civil 3D --");
try { Log($" Alignments: {cd.GetAlignmentIds().Count}"); } catch {}
try { Log($" Surfaces: {cd.GetSurfaceIds().Count}"); } catch {}
try { Log($" Pipe networks: {cd.GetPipeNetworkIds().Count}"); } catch {}
int sites=0, parcels=0; try { foreach (ObjectId sid in cd.GetSiteIds()) { sites++; parcels += ((Autodesk.Civil.DatabaseServices.Site)Tx.GetObject(sid,OpenMode.ForRead)).GetParcelIds().Count; } } catch {}
Log($" Sites: {sites}, Parcels: {parcels}");
try { Log($" Point groups: {cd.PointGroups.Count}"); } catch {}
try { Log($" COGO points: {cd.CogoPoints.Count}"); } catch {}
} catch (System.Exception ex) { Log(" (no Civil doc: "+ex.Message+")"); }
Log("Inspection complete (read-only).");
Result
Log
Drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260619 - 3625 Stonewall Tell Rd, Atlanta, GA 30349, USA\260619 - 3625 Stonewall Tell Rd.dwg Model: blocks=0, attribBlocks=0, text=0, lines=0, polylines=0, arcs=0, circles=1, tables=0, other=373 -- Layers (7) top 25 -- 0: 361 C-ANNO-TABL-TTBL: 5 C-ANNO: 3 SS-BUFFER LANDSCAPE: 2 C-PROP-LINE: 1 SS-FLOW WELL: 1 SS-V-ROAD-CURB: 1 -- Blocks (0) -- -- Attributed blocks (title block etc.) -- -- Layouts (sheets) -- [1] '11X17' (214 ents) [2] 'HOUSEDIM' (338 ents) -- Civil 3D -- Alignments: 0 Surfaces: 0 Pipe networks: 0 Sites: 8, Parcels: 0 Point groups: 20 COGO points: 361 Inspection complete (read-only).
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.