← Inbox

C3D-0093 · READ-ONLY: capture the DELTA OFF curve label style in full [READ-DELTA-OFF2] done

Dumps every text component of the DELTA OFF parcel curve label style, reflecting the real StyleText and Leader property surfaces so nothing is missed or misnamed, so the style can be rebuilt in another drawing. No changes.

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

C# payload

// READ-ONLY. Capture the user's "DELTA OFF" parcel curve label style completely, so it can be
// rebuilt in another drawing once that one is active. Dump EVERY text component with all its
// settings, plus the leader and general properties. Nothing is modified.
var civil = CivilApplication.ActiveDocument;
Func<Func<string>, string> safe = f => { try { return f(); } catch (System.Exception ex) { return "<" + ex.GetType().Name + ">"; } };

Log("drawing: " + Db.Filename);
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.IsErased) continue;
    string nm = safe(() => s.Name);
    if (nm.ToUpper().IndexOf("DELTA OFF") < 0) continue;

    Log("=== STYLE \"" + nm + "\" ===");
    Log("  Description " + safe(() => s.Description));

    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;
        Log("");
        Log("  COMPONENT \"" + safe(() => c.Name) + "\"");
        Log("    Visible     " + safe(() => c.General.Visible.Value.ToString()));
        Log("    Anchor      " + safe(() => c.General.AnchorComponent.Value));
        Log("    AnchorPt    " + safe(() => c.General.AnchorLocation.Value.ToString()));
        Log("    CONTENTS    " + safe(() => c.Text.Contents.Value));
        // reflect StyleText so every real property is captured - Justification/MaxWidth do not exist
        var tt = c.Text.GetType();
        var pnames = new List<string>();
        foreach (var pr in tt.GetProperties()) pnames.Add(pr.Name);
        pnames.Sort();
        foreach (var pn in pnames) {
            if (pn == "Contents") continue;
            string val = safe(() => {
                var pv = tt.GetProperty(pn).GetValue(c.Text, null);
                if (pv == null) return "<null>";
                var vp = pv.GetType().GetProperty("Value");
                return vp != null ? Convert.ToString(vp.GetValue(pv, null)) : pv.ToString();
            });
            Log("    " + pn.PadRight(12) + val);
        }
    }

    Log("");
    Log("  -- leader --");
    var lt2 = s.Properties.Leader.GetType();
    var lnames = new List<string>();
    foreach (var pr in lt2.GetProperties()) lnames.Add(pr.Name);
    lnames.Sort();
    foreach (var pn in lnames) {
        string val = safe(() => {
            var pv = lt2.GetProperty(pn).GetValue(s.Properties.Leader, null);
            if (pv == null) return "<null>";
            var vp = pv.GetType().GetProperty("Value");
            return vp != null ? Convert.ToString(vp.GetValue(pv, null)) : pv.ToString();
        });
        Log("    " + pn.PadRight(16) + val);
    }
}

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-0093 (0 entities touched).
Entities
Duration
830 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

=== STYLE "DELTA OFF" ===
  Description 

  COMPONENT "Table Tag"
    Visible     True
    Anchor      
    AnchorPt    LabelLocation
    CONTENTS    C<[Parcel Curve Number]>
    Angle       0
    Attachment  <AmbiguousMatchException>
    Color       BYLAYER
    Height      0.008333333333333333
    Lineweight  <AmbiguousMatchException>
    MaxWidth    0
    XOffset     0
    YOffset     0.0020833333333333333

  COMPONENT "Distance & Radius"
    Visible     True
    Anchor      
    AnchorPt    LabelLocation
    CONTENTS    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)]>'
    Angle       0
    Attachment  <AmbiguousMatchException>
    Color       BYLAYER
    Height      0.008333333333333333
    Lineweight  <AmbiguousMatchException>
    MaxWidth    0
    XOffset     0
    YOffset     -0.0020833333333333333

  COMPONENT "Delta"
    Visible     False
    Anchor      
    AnchorPt    LabelLocation
    CONTENTS    {\fSimplex|b0|i0|c161|p2;\U+0394\fSimplex|b0|i0|c0|p0;=}<[Segment Delta Angle(Udeg|FD|P2|RN|AP|OF)]>
    Angle       0
    Attachment  <AmbiguousMatchException>
    Color       BYLAYER
    Height      0.008333333333333333
    Lineweight  <AmbiguousMatchException>
    MaxWidth    0
    XOffset     0
    YOffset     0.0020833333333333333

  -- leader --
    ArrowheadSize   0.008333333333333333
    ArrowheadStyle  Closed filled
    Color           BYLAYER
    Linetype        ByBlock
    Lineweight      <AmbiguousMatchException>
    Shape           <AmbiguousMatchException>
    Visibility      True

Notes

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

No notes yet.