C3D-0171 · Re-split the flood values so each leads with its wording [FIX-FLOOD-SPLIT] done
Sets FIRM_PANEL to the panel number with a trailing comma, FIRM_DATE to EFFECTIVE plus the date, and FLOOD_ZONE to AND LIES IN ZONE plus the zone, so each attribute carries its own leading words. Only the three flood attributes are changed, and the assembled sentence is read back.
C# payload
// Re-split the flood values so each attribute LEADS with its connecting words, per the user:
// 1) "13113C0155E,"
// 2) "EFFECTIVE SEPTEMBER 26, 2008,"
// 3) "AND LIES IN ZONE X."
// Only the three flood attributes are touched; every other attribute is left alone.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);
var want = new Dictionary<string,string>();
want["FIRM_PANEL"] = "13113C0155E,";
want["FIRM_DATE"] = "EFFECTIVE SEPTEMBER 26, 2008,";
want["FLOOD_ZONE"] = "AND LIES IN ZONE X.";
int n = 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 || br.Name != "SS_BLOCK_11X17") continue;
foreach (ObjectId aid in br.AttributeCollection) {
var at0 = Tx.GetObject(aid, OpenMode.ForRead) as AttributeReference;
if (at0 == null || !want.ContainsKey(at0.Tag)) continue;
var at = (AttributeReference)Tx.GetObject(aid, OpenMode.ForWrite);
string old = at.TextString;
at.TextString = want[at0.Tag];
n++;
Log(String.Format(" {0,-12} \"{1}\" -> \"{2}\"", at0.Tag, old, at.TextString));
}
}
}
Log("");
Log("flood attributes updated: " + n);
// read the whole note back as it will print
Log("");
Log("=== the note as it now reads ===");
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 || br.Name != "SS_BLOCK_11X17") continue;
string panel = "", date = "", zone = "";
foreach (ObjectId aid in br.AttributeCollection) {
var at = Tx.GetObject(aid, OpenMode.ForRead) as AttributeReference;
if (at == null) continue;
if (at.Tag == "FIRM_PANEL") panel = at.TextString;
if (at.Tag == "FIRM_DATE") date = at.TextString;
if (at.Tag == "FLOOD_ZONE") zone = at.TextString;
}
Log(" ...COMMUNITY PANEL NO. " + panel + " " + date + " " + zone);
}
}
Ed.Regen();
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd.dwg FIRM_PANEL "13113C0155E, EFFECTIVE" -> "13113C0155E," FIRM_DATE "SEPTEMBER 26, 2008, AND LIES IN ZONE" -> "EFFECTIVE SEPTEMBER 26, 2008," FLOOD_ZONE "X." -> "AND LIES IN ZONE X." flood attributes updated: 3 === the note as it now reads === ...COMMUNITY PANEL NO. 13113C0155E, EFFECTIVE SEPTEMBER 26, 2008, AND LIES IN ZONE X.
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.