← Inbox

C3D-TB260619 · Fill title block for 260619 done

Sets the 22x17 title block attributes from the SurveyDisco record for job 260619 (Stonewall Tell / Enon First Baptist Church). DATE left as-is. Reads back and verifies each.

Script file
C3D-TB260619.cs
Target
active document · paper space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// Fill the SS_BLOCK_22X17 title block attributes for job 260619 (Stonewall Tell) from the
// SurveyDisco record. DATE is left at its existing value - not overwritten.
// Reads back each attribute after setting it and logs old -> new (verified). Idempotent.
// Host owns Tx - no using/Commit here. Host regens automatically after commit.
const string BLK = "SS_BLOCK_22X17", LAYOUT = "22X17 C";

var vals = new Dictionary<string,string> {
    { "JOB_NO", @"JOB NO.: 260619" },
    { "SITE_ADDRESS", @"3625 STONEWALL TELL ROAD, ATLANTA, GEORGIA 30349" },
    { "REF_DB_PG", @"REF DB 28196 PAGE 23" },
    { "LAND_LOT", @"LAND LOT: 125, 142, 143" },
    { "DISTRICT", @"DISTRICT: 14TH" },
    { "COUNTY", @"COUNTY: FULTON" },
    { "SUBDIVISION_NAME_LOT", @"PB 64 PG 100" },
    { "PREP_FOR", @"ENON FIRST BAPTIST CHURCH" },
    { "SURVEY_TYPE", @"LOT RE-CONFIGURATION SURVEY" },
};

var layDict = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
var layout  = (Layout)Tx.GetObject(layDict.GetAt(LAYOUT), OpenMode.ForRead);
var ps      = (BlockTableRecord)Tx.GetObject(layout.BlockTableRecordId, OpenMode.ForRead);

int refs = 0, set = 0;
foreach (ObjectId id in ps)
{
    var b0 = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
    if (b0 == null) continue;
    var d0 = (BlockTableRecord)Tx.GetObject(b0.BlockTableRecord, OpenMode.ForRead);
    if (d0.Name != BLK) continue;
    refs++;
    foreach (ObjectId aid in b0.AttributeCollection)
    {
        var ar = Tx.GetObject(aid, OpenMode.ForRead) as AttributeReference;
        if (ar == null) continue;
        if (!vals.ContainsKey(ar.Tag)) { Log($"    {ar.Tag} = '{ar.TextString}' (left alone)"); continue; }
        string want = vals[ar.Tag];
        if (ar.TextString == want) { Log($"    {ar.Tag} already '{want}'"); continue; }
        string old = ar.TextString;
        var w = (AttributeReference)Tx.GetObject(aid, OpenMode.ForWrite);
        w.TextString = want;
        string now = ((AttributeReference)Tx.GetObject(aid, OpenMode.ForRead)).TextString;
        Log($"    {ar.Tag}: '{old}' -> '{now}'{(now == want ? " (verified)" : " (MISMATCH)")}");
        set++;
    }
}
Log($"Updated {set} attribute(s) on {refs} '{BLK}' reference(s) for job 260619.");

Result

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

Log

    JOB_NO: 'JOB NO.: 251002' -> 'JOB NO.: 260619' (verified)
    SITE_ADDRESS: 'SITE_ADDRESS' -> '3625 STONEWALL TELL ROAD, ATLANTA, GEORGIA 30349' (verified)
    REF_DB_PG: 'REF DB xxx Page xxx' -> 'REF DB 28196 PAGE 23' (verified)
    LAND_LOT: 'LAND LOT: ###' -> 'LAND LOT: 125, 142, 143' (verified)
    DISTRICT: 'DISTRICT: #TH' -> 'DISTRICT: 14TH' (verified)
    COUNTY: 'COUNTY: CLAYCO' -> 'COUNTY: FULTON' (verified)
    DATE = 'DATE: 10/16/25' (left alone)
    SUBDIVISION_NAME_LOT: 'SUBDIVISION_NAME LOT ##' -> 'PB 64 PG 100' (verified)
    PREP_FOR: 'PREP_FOR' -> 'ENON FIRST BAPTIST CHURCH' (verified)
    SURVEY_TYPE: 'BOUNDARY SURVEY' -> 'LOT RE-CONFIGURATION SURVEY' (verified)
Updated 9 attribute(s) on 1 'SS_BLOCK_22X17' reference(s) for job 260619.

Notes

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

No notes yet.