← Inbox

C3D-0145 · Title block for job 260802 (clear stale 251103 data) [TB-FILL-260802] done

Writes every SS_BLOCK_11X17 attribute for job 260802 from the SurveyDisco job card - job number, address, Clayton county, date 08/09/26 from fieldDate, Demolition Survey - and BLANKS the fields with no data (land lot, district, prepared for, subdivision) rather than leaving job 251103 values in place. Re-reads every attribute afterwards to verify.

Script file
C3D-0145.cs
Target
active document · paper space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// Fill the SS_BLOCK_11X17 title block for job 260802.
//
// The block was carrying job 251103's data wholesale (2850 Riderwood Dr, Dekalb, LAND LOT 147,
// ANGELA & LLOYD BARNETT) - the stale-template hazard the title-block-fill recipe warns about.
// EVERY attribute is written, including the ones with no data: a field with no value is BLANKED,
// never left holding the previous job's answer. User: "if the data is not available it still
// should be updated just with blanks".
//
// Values from the SurveyDisco job card (GET /api/project-by-id?job_number=260802), re-read after
// an earlier misquote of serviceType:
//   jobNumber 260802 | geoAddress 4082 Sweetbriar Ln, Forest Park, GA 30297, USA
//   county Clayton   | fieldDate 2026-08-09 -> DATE: 08/09/26 (the recipe's DATE source)
//   serviceType "Demolition Survey"
//   landLot / district / preparedFor / client: ABSENT on the card -> written blank
//
// Each attribute keeps its own label prefix, matching how the block already reads.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);

var want = new Dictionary<string,string>();
want["JOB_NO"]               = "JOB NO.: 260802";
want["SITE_ADDRESS"]         = "4082 Sweetbriar Ln, Forest Park, GA 30297, USA";
want["COUNTY"]               = "COUNTY: Clayton";
want["DATE"]                 = "DATE: 08/09/26";
want["SURVEY_TYPE"]          = "Demolition Survey";
want["LAND_LOT"]             = "LAND LOT: ";     // not on the job card - blanked, not inherited
want["DISTRICT"]             = "DISTRICT: ";     // not on the job card - blanked
want["PREP_FOR"]             = "";               // preparedFor empty on the card
want["REF_DB_PG"]            = "REF DB  Page ";  // deed 13539/136 exists but this field's format is unclear - left as the empty label
want["SUBDIVISION_NAME_LOT"] = "";

int blocks = 0, set = 0, blanked = 0;
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, 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.ToUpper().IndexOf("SS_BLOCK") < 0) continue;
        blocks++;
        Log("");
        Log("BLOCK \"" + br.Name + "\" [" + br.Handle + "] in " + btr.Name);
        foreach (ObjectId aid in br.AttributeCollection) {
            var at0 = Tx.GetObject(aid, OpenMode.ForRead) as AttributeReference;
            if (at0 == null || !want.ContainsKey(at0.Tag)) continue;
            string old = at0.TextString, neu = want[at0.Tag];
            if (old == neu) { Log(String.Format("   {0,-22} unchanged", at0.Tag)); continue; }
            var at = (AttributeReference)Tx.GetObject(aid, OpenMode.ForWrite);
            at.TextString = neu;
            set++;
            if (neu.Trim().Length == 0 || neu.TrimEnd().EndsWith(":")) blanked++;
            Log(String.Format("   {0,-22} \"{1}\"  ->  \"{2}\"", at0.Tag, old, neu));
        }
    }
}

Log("");
Log("blocks touched: " + blocks + "   attributes written: " + set + "   (of those, blanked: " + blanked + ")");

// verify by re-reading
Log("");
Log("=== VERIFY ===");
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, 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.ToUpper().IndexOf("SS_BLOCK") < 0) continue;
        foreach (ObjectId aid in br.AttributeCollection) {
            var at = Tx.GetObject(aid, OpenMode.ForRead) as AttributeReference;
            if (at != null) Log(String.Format("   {0,-22} = \"{1}\"", at.Tag, at.TextString));
        }
    }
}
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
Message
Executed C3D-0145 (0 entities touched).
Entities
Duration
431 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg

BLOCK "SS_BLOCK_11X17" [20355] in *Paper_Space
   JOB_NO                 "JOB NO.: 251103"  ->  "JOB NO.: 260802"
   SITE_ADDRESS           "2850 Riderwood Dr, Decatur, GA 30033, USA"  ->  "4082 Sweetbriar Ln, Forest Park, GA 30297, USA"
   REF_DB_PG              unchanged
   LAND_LOT               "LAND LOT: 147"  ->  "LAND LOT: "
   DISTRICT               "DISTRICT: 18th"  ->  "DISTRICT: "
   COUNTY                 "COUNTY: Dekalb"  ->  "COUNTY: Clayton"
   DATE                   "DATE: 11/11/25"  ->  "DATE: 08/09/26"
   SUBDIVISION_NAME_LOT   unchanged
   PREP_FOR               "ANGELA & LLOYD BARNETT"  ->  ""
   SURVEY_TYPE            "Survey"  ->  "Demolition Survey"

blocks touched: 1   attributes written: 8   (of those, blanked: 3)

=== VERIFY ===
   JOB_NO                 = "JOB NO.: 260802"
   SITE_ADDRESS           = "4082 Sweetbriar Ln, Forest Park, GA 30297, USA"
   REF_DB_PG              = "REF DB  Page "
   LAND_LOT               = "LAND LOT: "
   DISTRICT               = "DISTRICT: "
   COUNTY                 = "COUNTY: Clayton"
   DATE                   = "DATE: 08/09/26"
   SUBDIVISION_NAME_LOT   = ""
   PREP_FOR               = ""
   SURVEY_TYPE            = "Demolition Survey"

Notes

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

No notes yet.