← Inbox

C3D-TBDATE · Title block: DATE 07/16/26 + SUBDIVISION Lakewood Heights done

DATE from the point data file 358 HOUSE.txt (modified 07/16/26). SUBDIVISION_NAME_LOT = Lakewood Heights (neighborhood per job record); no lot number known, left off. Reads back + verifies; idempotent.

Script file
C3D-TBDATE.cs
Target
active document · model space
Author
claude
Approved
yes · reviewer
Timeout
60s

C# payload

// Finish the 260702 title block: DATE from the point-data file (358 HOUSE.txt, 07/16/26)
// and SUBDIVISION_NAME_LOT = neighborhood (Lakewood Heights); no lot number known.
var want = new Dictionary<string, string> {
    { "DATE",                 "DATE: 07/16/26" },
    { "SUBDIVISION_NAME_LOT", "Lakewood Heights" },
};
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
int hits = 0;
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    if (!btr.IsLayout) continue;
    foreach (ObjectId id in btr) {
        var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
        if (br == null || br.AttributeCollection == null || br.AttributeCollection.Count == 0) continue;
        var def = (BlockTableRecord)Tx.GetObject(br.DynamicBlockTableRecord, OpenMode.ForRead);
        if (def.Name != "SS_BLOCK_11X17") continue;
        foreach (ObjectId aid in br.AttributeCollection) {
            var ar = (AttributeReference)Tx.GetObject(aid, OpenMode.ForWrite);
            if (!want.ContainsKey(ar.Tag)) continue;
            string oldv = ar.TextString, newv = want[ar.Tag];
            if (oldv == newv) { Log($"{ar.Tag}: already \"{newv}\" (no change)"); hits++; continue; }
            ar.TextString = newv;
            var chk = (AttributeReference)Tx.GetObject(aid, OpenMode.ForRead);
            Log($"{ar.Tag}: \"{oldv}\" -> \"{chk.TextString}\" (verified)");
            hits++;
        }
    }
}
Log($"TITLE BLOCK: {hits} attributes set.");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260702 - 358 St Johns Ave SW, Atlanta, GA 30315, USA\260702 - 358 St Johns Ave SW.dwg
Message
Executed C3D-TBDATE (0 entities touched).
Entities
Duration
622 ms
Civil 3D
25.0.0.0

Log

DATE: "DATE: 11/11/25" -> "DATE: 07/16/26" (verified)
SUBDIVISION_NAME_LOT: "" -> "Lakewood Heights" (verified)
TITLE BLOCK: 2 attributes set.

Notes

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

No notes yet.