C3D-FLOODFIX · Correct FIRM panel on flood note error
Replaces panel 13135C0016G / February 4, 2013 with 13121C0338F / September 18, 2013 from the SurveyDisco record for job 260619 (Fulton County). Zone X unchanged. Reads back and verifies.
C# payload
// Correct the flood note on 22X17 C: the FIRM panel/date were from another county.
// SurveyDisco record for job 260619 (Fulton County): firmPanel 13121C0338F,
// firmPanelDate 09/18/2013, floodZone X. Sheet had 13135C0016G / February 4, 2013 (Gwinnett).
// Targets the exact MText by handle-independent content match; reads back and verifies.
// Host owns Tx; host regens after commit.
const string LAYOUT = "22X17 C";
const string OLD_PANEL = "13135C0016G", NEW_PANEL = "13121C0338F";
const string OLD_DATE = "FEBRUARY 4, 2013", NEW_DATE = "SEPTEMBER 18, 2013";
var layDict = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
var layout = (Layout)Tx.GetObject(layDict.GetAt(LAYOUT), OpenMode.ForRead);
var ps = (BlockTableRecord)Tx.GetObject(layout.BlockTableRecordId, OpenMode.ForRead);
int fixedN = 0;
foreach (ObjectId id in ps)
{
var mt = Tx.GetObject(id, OpenMode.ForRead) as MText;
if (mt == null) continue;
var c = mt.Contents;
if (c == null || (!c.Contains(OLD_PANEL) && !c.ToUpper().Contains(OLD_DATE))) continue;
string updated = c.Replace(OLD_PANEL, NEW_PANEL);
// date appears in mixed case on the sheet - replace case-insensitively
int i = updated.ToUpper().IndexOf(OLD_DATE);
if (i >= 0) updated = updated.Substring(0, i) + NEW_DATE + updated.Substring(i + OLD_DATE.Length);
if (updated == c) { Log(" no change needed"); continue; }
var w = (MText)Tx.GetObject(id, OpenMode.ForWrite);
w.Contents = updated;
string now = ((MText)Tx.GetObject(id, OpenMode.ForRead)).Contents;
bool ok = now.Contains(NEW_PANEL) && now.Contains(NEW_DATE) && !now.Contains(OLD_PANEL);
Log($"MText {mt.Handle} on '{mt.Layer}':");
Log($" OLD: {c.Replace("
"," | ")}");
Log($" NEW: {now.Replace("
"," | ")}");
Log($" {(ok ? "(verified)" : "(MISMATCH)")}");
fixedN++;
}
Log($"Corrected {fixedN} flood note(s) to panel {NEW_PANEL}, {NEW_DATE}, Zone X (Fulton County).");
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.