← Inbox

C3D-TBRECON · Find title block attributes (read-only) done

Dump attributed blocks in layouts + model

Script file
C3D-TBRECON.cs
Target
active document · model space
Author
claude
Approved
yes · claude (session)
Timeout
60s

C# payload

// Read-only: find attributed blocks (title block) in all layouts + model; dump tags + values.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
void Dump(BlockTableRecord space, string where) {
    foreach (ObjectId id in space) {
        var o = Tx.GetObject(id, OpenMode.ForRead);
        if (o is BlockReference br && br.AttributeCollection.Count > 0) {
            var bn = ((BlockTableRecord)Tx.GetObject(br.IsDynamicBlock ? br.DynamicBlockTableRecord : br.BlockTableRecord, OpenMode.ForRead)).Name;
            Log($"[{where}] '{bn}' h={br.Handle} ({br.AttributeCollection.Count} attrs):");
            foreach (ObjectId aid in br.AttributeCollection) { var a = (AttributeReference)Tx.GetObject(aid, OpenMode.ForRead); Log($"    {a.Tag} = \"{a.TextString}\""); }
        }
    }
}
Dump((BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead), "MODEL");
var ld = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry de in ld) {
    var lo = (Layout)Tx.GetObject(de.Value, OpenMode.ForRead);
    if (lo.LayoutName == "Model") continue;
    Dump((BlockTableRecord)Tx.GetObject(lo.BlockTableRecordId, OpenMode.ForRead), lo.LayoutName);
}
Log("Title-block recon complete (read-only).");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260619 - 3625 Stonewall Tell Rd, Atlanta, GA 30349, USA\260619 - 3625 Stonewall Tell Rd.dwg
Message
Executed C3D-TBRECON (0 entities touched).
Entities
Duration
405 ms
Civil 3D
25.0.0.0

Log

[11X17] 'SS_BLOCK_11X17' h=20355 (10 attrs):
    JOB_NO = "JOB NO.: 251103"
    SITE_ADDRESS = "2850 Riderwood Dr, Decatur, GA 30033, USA"
    REF_DB_PG = "REF DB  Page "
    LAND_LOT = "LAND LOT: 147"
    DISTRICT = "DISTRICT: 18th"
    COUNTY = "COUNTY: Dekalb"
    DATE = "DATE: 11/11/25"
    SUBDIVISION_NAME_LOT = ""
    PREP_FOR = "ANGELA & LLOYD BARNETT"
    SURVEY_TYPE = "Survey"
Title-block recon complete (read-only).

Notes

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

No notes yet.