C3D-0160 · READ-ONLY: the FEMA / flood note as it stands [FEMA-READ] error
Finds the flood note wherever it lives - as a block attribute, an attribute definition inside a block definition, or plain text - across every layout and block definition, reporting the exact text, tag, height and layer. No changes.
C# payload
// READ-ONLY. The FEMA / flood note as it exists right now - the exact text, whether it is an
// attribute or plain text, and where it lives. Searched across every layout AND every block
// definition, since the note lives inside the title block definition rather than model space.
// Nothing is modified.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);
Log("=== ATTRIBUTES mentioning flood / firm / panel / zone ===");
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;
foreach (ObjectId aid in br.AttributeCollection) {
var at = Tx.GetObject(aid, OpenMode.ForRead) as AttributeReference;
if (at == null) continue;
string blob = (at.Tag + " " + at.TextString).ToUpper();
if (blob.IndexOf("FLOOD") < 0 && blob.IndexOf("FIRM") < 0 && blob.IndexOf("PANEL") < 0
&& blob.IndexOf("ZONE") < 0 && blob.IndexOf("FEMA") < 0) continue;
Log(String.Format(" [{0}] block \"{1}\" in {2}", at.Handle, br.Name, btr.Name));
Log(String.Format(" TAG \"{0}\" = \"{1}\"", at.Tag, at.TextString));
}
}
}
Log("");
Log("=== ATTRIBUTE DEFINITIONS in block definitions (the template side) ===");
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
if (btr.IsLayout) continue;
foreach (ObjectId id in btr) {
var ad = Tx.GetObject(id, OpenMode.ForRead) as AttributeDefinition;
if (ad == null) continue;
Log(String.Format(" [{0}] in \"{1}\" TAG \"{2}\" prompt \"{3}\" default \"{4}\" h={5:F3}",
ad.Handle, btr.Name, ad.Tag, ad.Prompt, ad.TextString, ad.Height));
}
}
Log("");
Log("=== TEXT mentioning flood / firm / panel / zone (all spaces + block defs) ===");
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("FLOOD") < 0 && u.IndexOf("FIRM") < 0 && u.IndexOf("PANEL") < 0 && u.IndexOf("FEMA") < 0) continue;
var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
Log("");
Log(String.Format(" [{0}] {1} in {2} layer={3} h={4:F3}", o.Handle, o.GetType().Name, btr.Name, ent.Layer,
mt != null ? mt.TextHeight : dt.Height));
Log(" " + s.Replace("\P", "\n "));
}
}
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.