C3D-260619-R2 · Redline 2 - fix Tract A bearing quadrants error
Corrects the three reversed Tract "A" bearing labels (north S89-59-36E -> N89-59-40W, east S12-52-11W -> N12-52-08E, south N10-39-27E -> S10-39-20W). Values computed from the surveyed geometry. Edits the text inside the anonymous annotation block definitions.
C# payload
// REDLINE #2 - Tract "A" bearing quadrants are reversed.
// Verified against the actual SS-HERO TRACT A geometry (azimuths computed from the surveyed
// endpoints, not assumed):
// north line 210.00' label S89d59'36"E -> computed N89d59'40"W
// east line 220.00' label S12d52'11"W -> computed N12d52'08"E
// south line 210.00' label N10d39'27"E -> computed S10d39'20"W
// The labels were written for the opposite direction of travel. The redline calls for
// North -> N_W, East -> N_E, South -> S_W, which matches the computed values.
//
// The labels are anonymous BlockReferences (*U200..*U207) created when the parcel labels were
// exploded, so the text lives inside each block DEFINITION. This edits the DBText/MText inside
// those definitions - every reference updates.
// ADDS NOTHING, erases nothing. Host owns Tx; host regens after commit.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
// collect the block definitions used by the TRACT A/B ANNO references
var defs = new List<ObjectId>();
foreach (ObjectId id in ms)
{
var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
if (br == null) continue;
if (!br.Layer.ToUpper().Contains("HERO TRACT")) continue;
if (!defs.Contains(br.BlockTableRecord)) defs.Add(br.BlockTableRecord);
}
Log(defs.Count + " annotation block definitions on the HERO TRACT layers");
int changed = 0;
foreach (var did in defs)
{
var def = (BlockTableRecord)Tx.GetObject(did, OpenMode.ForRead);
foreach (ObjectId cid in def)
{
var ce = Tx.GetObject(cid, OpenMode.ForRead);
var dt = ce as DBText;
if (dt != null)
{
string before = dt.TextString, after = Fix(before);
if (after == before) continue;
var w = (DBText)Tx.GetObject(cid, OpenMode.ForWrite);
w.TextString = after;
Log(" '" + def.Name + "' \"" + before + "\" -> \"" +
((DBText)Tx.GetObject(cid, OpenMode.ForRead)).TextString + "\" (verified)");
changed++;
continue;
}
var mt = ce as MText;
if (mt != null)
{
string before = mt.Contents, after = Fix(before);
if (after == before) continue;
var w = (MText)Tx.GetObject(cid, OpenMode.ForWrite);
w.Contents = after;
Log(" '" + def.Name + "' \"" + before + "\" -> \"" +
((MText)Tx.GetObject(cid, OpenMode.ForRead)).Contents + "\" (verified)");
changed++;
}
}
}
Log("Redline #2 - corrected " + changed + " bearing label(s).");
string Fix(string s)
{
if (string.IsNullOrEmpty(s)) return s;
// north line, 210.00'
s = s.Replace("S89\U+00B0 59' 36\"E", "N89\U+00B0 59' 40\"W");
// east line, 220.00'
s = s.Replace("S12\U+00B0 52' 11\"W", "N12\U+00B0 52' 08\"E");
// south line, 210.00'
s = s.Replace("N10\U+00B0 39' 27\"E", "S10\U+00B0 39' 20\"W");
return s;
}
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.