C3D-0089 · Write the ARC/CHD/RAD format into CURVE DELTA OFF [MK-CURVE-STYLE4] error
The previous run matched components by name and missed, because the source component is Distance & Radius while the new style inherited Standard Distance and Radius. Writes the exact ARC/CHD/bearing/RAD template into the non-tag text component. No erase; verifies the contents afterwards.
C# payload
// Put the ARC/CHD/bearing/RAD format into "CURVE DELTA OFF".
//
// Last run matched components BY NAME and missed: the source calls it "Distance & Radius"
// (ampersand), the new style inherits Standard's "Distance and Radius" (word). So the format was
// never written and the style still emits L=..., R=...
//
// This writes the format template LITERALLY - the exact string read from the source in C3D-0083 -
// into whichever text component is not the Table Tag. No name matching, no CopyFrom, NO ERASE.
const string DST = "CURVE DELTA OFF";
// verbatim from "Delta over Length and Radius" / component "Distance & Radius"
const string FORMAT =
"ARC-<[Segment Length(Uft|P2|RN|AP|Sn|OF)]>'\PCHD-<[Segment Chord Length(Uft|P2|RN|AP|GC|UN|Sn|OF)]>'\P<[Segment Chord Direction(Udeg|FDMSdSp|MB|P4|RN|DSn|CU|AP|EN|DZY|OF)]>\PRAD-<[Segment Radius(Uft|P2|RN|AP|Sn|OF)]>'";
var civil = CivilApplication.ActiveDocument;
Log("drawing: " + Db.Filename);
ObjectId dstId = ObjectId.Null;
foreach (ObjectId sid in civil.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles) {
var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (s != null && s.Name == DST) { dstId = sid; break; }
}
if (dstId.IsNull) { Log("ABORT: \"" + DST + "\" not found"); return; }
var dst = (Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(dstId, OpenMode.ForWrite);
int wrote = 0;
foreach (ObjectId cid in dst.GetComponents(Autodesk.Civil.DatabaseServices.Styles.LabelStyleComponentType.Text)) {
var c = Tx.GetObject(cid, OpenMode.ForWrite) as Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent;
if (c == null) continue;
if (c.Name == "Table Tag") continue; // leave the curve-number tag alone
string was = "";
try { was = c.Text.Contents.Value; } catch { }
c.Text.Contents.Value = FORMAT;
wrote++;
Log(" \"" + c.Name + "\"");
Log(" was " + (was.Length > 60 ? was.Substring(0,60) + "..." : was));
Log(" now ARC-.. CHD-.. <chord dir> RAD-..");
}
Log("components written: " + wrote);
Log("");
foreach (ObjectId sid in civil.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles) {
var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (s == null || s.Name != DST) continue;
Log("VERIFY \"" + s.Name + "\"");
foreach (ObjectId cid in s.GetComponents(Autodesk.Civil.DatabaseServices.Styles.LabelStyleComponentType.Text)) {
var c = Tx.GetObject(cid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent;
if (c == null) continue;
bool v = true; try { v = c.General.Visible.Value; } catch { }
string ct = ""; try { ct = c.Text.Contents.Value; } catch { }
Log(" \"" + c.Name + "\" visible=" + v);
Log(" " + (ct.Length > 90 ? ct.Substring(0,90) + "..." : ct));
}
}
Ed.Regen();
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.