← Inbox

C3D-0169 · READ-ONLY: is the title block inserted in 260714 [FIND-TB] done

Reports whether the SS_BLOCK_11X17 definition exists and lists every block reference in every space with position and attribute count, plus a type breakdown of paper space, to determine whether the title block insert was erased. No changes.

Script file
C3D-0169.cs
Target
260714 · paper space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// READ-ONLY. Is the title block inserted anywhere in this drawing? Report every block reference
// in every space, plus whether the definition exists. Nothing is modified.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);
Log("SS_BLOCK_11X17 definition present: " + bt.Has("SS_BLOCK_11X17"));

int total = 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) continue;
        total++;
        if (br.Name.ToUpper().IndexOf("SS_BLOCK") >= 0 || br.Name.ToUpper().IndexOf("TB") >= 0)
            Log(String.Format("  [{0}] \"{1}\" in {2} at {3:F4},{4:F4} attribs={5}",
                br.Handle, br.Name, btr.Name, br.Position.X, br.Position.Y, br.AttributeCollection.Count));
    }
}
Log("block references in the drawing: " + total);

Log("");
Log("=== paper space contents by type ===");
var ps = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForRead);
var counts = new Dictionary<string,int>();
foreach (ObjectId id in ps) {
    var o = Tx.GetObject(id, OpenMode.ForRead);
    string t = o.GetType().Name;
    if (!counts.ContainsKey(t)) counts[t] = 0;
    counts[t]++;
}
foreach (var kv in counts) Log("   " + kv.Key + " : " + kv.Value);

Result

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

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd.dwg
SS_BLOCK_11X17 definition present: True
block references in the drawing: 24

=== paper space contents by type ===
   Viewport : 2
   Line : 112
   Polyline2d : 10
   DBText : 65
   Arc : 5
   MText : 3
   Circle : 2
   Polyline : 9
   Solid : 4
   BlockReference : 1

Notes

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

No notes yet.