← Inbox

C3D-0687 · Set title block DATE to 11/05/26 on 260714 22x17 done

Changes the DATE title block attribute from DATE: 09/22/26 to DATE: 11/05/26 on layouts 17X11, 22X17 (2), COVER and COVER (22). Requested by the user. Leaves FIRM_DATE, revision text and notes alone.

Script file
C3D-0687.cs
Target
260714 · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// Sets the DATE title block attribute on the four sheet layouts. Touches nothing else.
// Idempotent: already-new values are left alone. Any surprise throws, so the host aborts it all.
const string OLD_VALUE = "DATE: 09/22/26";
const string NEW_VALUE = "DATE: 11/05/26";
var layouts = new HashSet<string> { "17X11", "22X17 (2)", "COVER", "COVER (22)" };
var seen = new HashSet<string>();
var ld = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry de in ld) {
    var lo = (Layout)Tx.GetObject(de.Value, OpenMode.ForRead);
    if (!layouts.Contains(lo.LayoutName)) continue;
    var btr = (BlockTableRecord)Tx.GetObject(lo.BlockTableRecordId, OpenMode.ForRead);
    foreach (ObjectId id in btr) {
        var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
        if (br == null || br.AttributeCollection.Count == 0) continue;
        if (br.Name != "SS_BLOCK_17X11" && br.Name != "SS_BLOCK_22X17_TB") continue;
        foreach (ObjectId aid in br.AttributeCollection) {
            var a = (AttributeReference)Tx.GetObject(aid, OpenMode.ForRead);
            if (a.Tag != "DATE") continue;
            if (!seen.Add(lo.LayoutName)) throw new System.Exception("more than one DATE attribute on " + lo.LayoutName);
            var old = a.TextString;
            if (old == NEW_VALUE) { Log("[" + lo.LayoutName + "] already " + NEW_VALUE); continue; }
            if (old != OLD_VALUE) throw new System.Exception("[" + lo.LayoutName + "] unexpected value: " + old);
            a.UpgradeOpen();
            a.TextString = NEW_VALUE;
            if (a.TextString != NEW_VALUE) throw new System.Exception("[" + lo.LayoutName + "] read-back failed: " + a.TextString);
            Log("[" + lo.LayoutName + "] DATE: \"" + old + "\" -> \"" + a.TextString + "\" (verified)");
        }
    }
}
if (seen.Count != 4) throw new System.Exception("expected 4 DATE attributes, found " + seen.Count);
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd 22x17.dwg
Message
Executed C3D-0687 (0 entities touched).
Entities
—
Duration
1080 ms
Civil 3D
26.0.0.0

Log

[17X11] DATE: "DATE: 09/22/26" -> "DATE: 11/05/26" (verified)
[22X17 (2)] DATE: "DATE: 09/22/26" -> "DATE: 11/05/26" (verified)
[COVER] DATE: "DATE: 09/22/26" -> "DATE: 11/05/26" (verified)
[COVER (22)] DATE: "DATE: 09/22/26" -> "DATE: 11/05/26" (verified)

Notes

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

No notes yet.