← Inbox

C3D-TBFILL · Fill title block - job 260619 done

Set SS_BLOCK_11X17 attributes from the 260619 job data (church lot re-configuration survey); clears prior job's stale values.

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

C# payload

// Fill SS_BLOCK_11X17 title block with job 260619 data. Clears stale values from the prior job.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var vals = new Dictionary<string, string> {
    { "JOB_NO", "JOB NO.: 260619" },
    { "SITE_ADDRESS", "3625 Stonewall Tell Rd, Atlanta, GA 30349, USA" },
    { "REF_DB_PG", "REF DB  Page " },
    { "LAND_LOT", "LAND LOT: " },
    { "DISTRICT", "DISTRICT: " },
    { "COUNTY", "COUNTY: Fulton" },
    { "DATE", "DATE: 07/15/26" },
    { "SUBDIVISION_NAME_LOT", "" },
    { "PREP_FOR", "BOARD OF DEACONS OF THE ENON FIRST BAPTIST CHURCH" },
    { "SURVEY_TYPE", "LOT RE-CONFIGURATION SURVEY" },
};
int set = 0;
void FillIn(BlockTableRecord space) {
    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;
            if (bn != "SS_BLOCK_11X17") continue;
            foreach (ObjectId aid in br.AttributeCollection) {
                var a = (AttributeReference)Tx.GetObject(aid, OpenMode.ForRead);
                if (vals.TryGetValue(a.Tag, out var v)) {
                    var w = (AttributeReference)Tx.GetObject(aid, OpenMode.ForWrite);
                    string old = w.TextString; w.TextString = v; try { w.AdjustAlignment(Db); } catch {}
                    Log($"  {a.Tag}: \"{old}\" -> \"{v}\""); set++;
                }
            }
        }
    }
}
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; FillIn((BlockTableRecord)Tx.GetObject(lo.BlockTableRecordId, OpenMode.ForRead)); }
Log($"Title block filled: {set} attributes.");

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-TBFILL (0 entities touched).
Entities
Duration
1954 ms
Civil 3D
25.0.0.0

Log

  JOB_NO: "JOB NO.: 251103" -> "JOB NO.: 260619"
  SITE_ADDRESS: "2850 Riderwood Dr, Decatur, GA 30033, USA" -> "3625 Stonewall Tell Rd, Atlanta, GA 30349, USA"
  REF_DB_PG: "REF DB  Page " -> "REF DB  Page "
  LAND_LOT: "LAND LOT: 147" -> "LAND LOT: "
  DISTRICT: "DISTRICT: 18th" -> "DISTRICT: "
  COUNTY: "COUNTY: Dekalb" -> "COUNTY: Fulton"
  DATE: "DATE: 11/11/25" -> "DATE: 07/15/26"
  SUBDIVISION_NAME_LOT: "" -> ""
  PREP_FOR: "ANGELA & LLOYD BARNETT" -> "BOARD OF DEACONS OF THE ENON FIRST BAPTIST CHURCH"
  SURVEY_TYPE: "Survey" -> "LOT RE-CONFIGURATION SURVEY"
Title block filled: 10 attributes.

Notes

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

No notes yet.