← Inbox

C3D-0144 · READ-ONLY: layouts, title block attributes, vicinity/flood text [TB-READ-2] done

Lists every layout, every block reference carrying attributes with its current values, any text mentioning vicinity/flood/zone/FIRM/panel, and any raster or OLE object, so stale template data carried from a previous job can be spotted before the title block is filled. No changes.

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

C# payload

// READ-ONLY. Layouts, title-block attributes and any VICINITY MAP placeholder in this drawing.
// The title-block-fill recipe's #1 hazard is STALE TEMPLATE DATA carried from a previous job, so
// every existing attribute value is dumped for comparison against the job record. Nothing is modified.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);

Log("=== LAYOUTS ===");
var dict = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry de in dict) {
    var lay = (Layout)Tx.GetObject(de.Value, OpenMode.ForRead);
    var btr = (BlockTableRecord)Tx.GetObject(lay.BlockTableRecordId, OpenMode.ForRead);
    int cnt = 0; foreach (ObjectId x in btr) cnt++;
    Log(String.Format("  \"{0}\"  tab={1}  entities={2}", lay.LayoutName, lay.TabOrder, cnt));
}

Log("");
Log("=== BLOCK REFERENCES WITH ATTRIBUTES (all spaces) ===");
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) continue;
        if (br.AttributeCollection.Count == 0) continue;
        Log("");
        Log("  BLOCK \"" + br.Name + "\" [" + br.Handle + "] in " + btr.Name + "  layer=" + br.Layer);
        foreach (ObjectId aid in br.AttributeCollection) {
            var at = Tx.GetObject(aid, OpenMode.ForRead) as AttributeReference;
            if (at == null) continue;
            Log(String.Format("      {0,-22} = \"{1}\"", at.Tag, at.TextString));
        }
    }
}

Log("");
Log("=== TEXT MENTIONING VICINITY / FLOOD / ZONE / FIRM / PANEL (all spaces) ===");
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    foreach (ObjectId id in btr) {
        Autodesk.AutoCAD.DatabaseServices.DBObject o;
        try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
        string s = null;
        var mt = o as MText;  if (mt != null) s = mt.Contents;
        var dt = o as DBText; if (dt != null) s = dt.TextString;
        if (s == null) continue;
        string u = s.ToUpper();
        if (u.IndexOf("VICINITY") < 0 && u.IndexOf("FLOOD") < 0 && u.IndexOf("ZONE") < 0
            && u.IndexOf("FIRM") < 0 && u.IndexOf("PANEL") < 0) continue;
        var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
        Log(String.Format("  [{0}] in {1} layer={2}  \"{3}\"", o.Handle, btr.Name, ent.Layer,
            s.Length > 90 ? s.Substring(0,90)+"..." : s));
    }
}

Log("");
Log("=== RASTER IMAGES / OLE (existing vicinity map?) ===");
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    foreach (ObjectId id in btr) {
        Autodesk.AutoCAD.DatabaseServices.DBObject o;
        try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
        if (o is RasterImage || o is Ole2Frame)
            Log("  [" + o.Handle + "] " + o.GetType().Name + " in " + btr.Name);
    }
}

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-0144 (0 entities touched).
Entities
Duration
426 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
=== LAYOUTS ===
  "11X17"  tab=1  entities=214
  "HOUSEDIM"  tab=2  entities=338
  "Model"  tab=0  entities=145

=== BLOCK REFERENCES WITH ATTRIBUTES (all spaces) ===

  BLOCK "SS_BLOCK_11X17" [20355] in *Paper_Space  layer=BLOCK_TB2
      JOB_NO                 = "JOB NO.: 251103"
      SITE_ADDRESS           = "2850 Riderwood Dr, Decatur, GA 30033, USA"
      REF_DB_PG              = "REF DB  Page "
      LAND_LOT               = "LAND LOT: 147"
      DISTRICT               = "DISTRICT: 18th"
      COUNTY                 = "COUNTY: Dekalb"
      DATE                   = "DATE: 11/11/25"
      SUBDIVISION_NAME_LOT   = ""
      PREP_FOR               = "ANGELA & LLOYD BARNETT"
      SURVEY_TYPE            = "Survey"

=== TEXT MENTIONING VICINITY / FLOOD / ZONE / FIRM / PANEL (all spaces) ===
  [158D1] in *Paper_Space layer=BLOCK_NOTES_FLOOD  "FLOOD NOTE:\PTHIS PROPERTY IS NOT LOCATED WITHIN A SPECIAL FLOOD HAZARD AREA (SFHA) AS SHO..."
  [20955] in *Paper_Space layer=BLOCK_CLOSURE  "VICINITY MAP (NOT TO SCALE)"
  [14522] in A$C3840e5d8 layer=BLOCK_TB2  "FLOOD NOTE:\PTHIS PROPERTY IS NOT IN AN AREA HAVING SPECIAL FLOOD\PHAZARDS AS PER COMMUNIT..."
  [14528] in A$C3840e5d8 layer=SS-BOUNDARY  "\pxqc;{\LSITE INFORMATION\P}\P\pq*;JURISDICTION:  CITY OF JOHNS CREEK\PPARCEL ID NO.:  11 ..."
  [1E7AB] in *Paper_Space154 layer=BLOCK_TB2  "FLOOD NOTE:\PTHIS PROPERTY IS NOT IN AN AREA HAVING SPECIAL FLOOD AS PER COMMUNITY PANEL N..."
  [1E807] in *Paper_Space154 layer=SS-BOUNDARY LAND LOT  "VICINITY MAP (NOT TO SCALE)"
  [1FEA7] in 11x17 COVER SHEET SS layer=G-NOTE  "FLOOD INSURANCE RATE MAP"
  [1FEB6] in 11x17 COVER SHEET SS layer=C-0-GNRL-NOTE-INDX  "THE MAJORITY  SITE DOES NOT LIE WITHIN A 100 YEAR FLOOD HAZARD AREA AND IS LOCATED IN ZONE..."
  [1FF47] in SS_BLOCK_11X17 (1) layer=BLOCK_TB2  "VICINITY MAP (NOT TO SCALE)"
  [1FFCA] in SS_BLOCK_11X17 (2) layer=BLOCK_TB2  "VICINITY MAP (NOT TO SCALE)"
  [2007B] in SS_BLOCK_11X17 (3) layer=BLOCK_TB2  "VICINITY MAP (NOT TO SCALE)"

=== RASTER IMAGES / OLE (existing vicinity map?) ===
  [1DAC] Wipeout in _Wipeout_Circle
  [10C9C] Ole2Frame in A$C2CD672AE
  [10CA5] Ole2Frame in A$C2CD672AE
  [10CA6] Ole2Frame in A$C2CD672AE
  [1240A] Wipeout in _TagCircle
  [1E856] Ole2Frame in *Paper_Space154
  [1FEBB] Ole2Frame in 11x17 COVER SHEET SS
  [1FEBC] Ole2Frame in 11x17 COVER SHEET SS

Notes

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

No notes yet.