← Inbox

C3D-0090 · Write the ARC/CHD/RAD format into CURVE DELTA OFF [MK-CURVE-STYLE5] done

Writes the exact ARC/CHD/bearing/RAD template into the non-tag text component of CURVE DELTA OFF, using a verbatim string so the MText \P newline codes compile. No erase; verifies the contents afterwards.

Script file
C3D-0090.cs
Target
260612 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

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".
// MUST be a @"" verbatim string - \P is the MText newline code and a bare \P is CS1009 (cookbook 13).
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

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
Message
Executed C3D-0090 (0 entities touched).
Entities
Duration
745 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
  "Distance and Radius"
      was  L=<[Segment Length(Uft|P2|RN|Sn|OF|AP|GC|UN)]>, R=<[Segment ...
      now  ARC-.. CHD-.. <chord dir> RAD-..
components written: 1

VERIFY "CURVE DELTA OFF"
    "Table Tag" visible=True
        C<[Parcel Curve Number]>
    "Distance and Radius" visible=True
        ARC-<[Segment Length(Uft|P2|RN|AP|Sn|OF)]>'\PCHD-<[Segment Chord Length(Uft|P2|RN|AP|GC|UN...

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.