C3D-0143 · READ-ONLY: layouts, title block attributes, vicinity/flood text [TB-READ-260802] error
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.
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 lm = LayoutManager.Current;
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);
Log("=== LAYOUTS ===");
foreach (string nm in lm.GetLayoutIds().Count > 0 ? new string[]{} : new string[]{}) { }
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
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.