← Inbox

C3D-0369 · READ-ONLY: is anything left on the Aec layers after the explode? [C3D-AECCHK] done

Counts entities on every layer whose name starts with 'Aec' across model space and all layouts, and separately counts any surviving AEC-class objects anywhere in the drawing. Answers whether the explode left anything behind.

Script file
C3D-0369.cs
Target
260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// READ-ONLY. Count entities on every layer whose name starts with "Aec", across model space
// and all layouts, so we know if anything is left after the explode.
Log("drawing: " + Db.Filename);

var count = new Dictionary<string,int>();
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    foreach (ObjectId id in btr) {
        var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
        if (e == null) continue;
        if (!count.ContainsKey(e.Layer)) count[e.Layer]=0;
        count[e.Layer]++;
    }
}

var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
int total = 0;
Log("=== layers starting 'Aec' ===");
foreach (ObjectId id in lt) {
    var l = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    if (!l.Name.StartsWith("Aec", StringComparison.OrdinalIgnoreCase)) continue;
    int c = count.ContainsKey(l.Name) ? count[l.Name] : 0;
    total += c;
    Log(string.Format("  {0,-36} ents={1}  {2}{3}", l.Name, c, l.IsFrozen?"FRZ ":"", l.IsOff?"OFF":""));
}
Log("");
Log("total entities on Aec layers: " + total);

// also flag any surviving AEC proxy/native objects anywhere (they carry "Aec" in the class name)
int aecObjs = 0;
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    foreach (ObjectId id in btr) {
        var o = Tx.GetObject(id, OpenMode.ForRead);
        string cn = o.GetType().Name;
        if (cn.StartsWith("Aec", StringComparison.OrdinalIgnoreCase)) aecObjs++;
    }
}
Log("AEC-class objects still in the drawing (any layer): " + aecObjs);

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\ACAD-260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg
Message
Executed C3D-0369 (0 entities touched).
Entities
Duration
369 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\ACAD-260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg
=== layers starting 'Aec' ===
  AecObjExplode_22X17_Pspace           ents=1  
  AecObjExplode_11X17_Pspace           ents=0  
  AecObjExplode_22X17_Vport_1D7E       ents=0  

total entities on Aec layers: 1
AEC-class objects still in the drawing (any layer): 0

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.