← Inbox

C3D-0092 · READ-ONLY: capture the DELTA OFF curve label style in full [READ-DELTA-OFF] error

Dumps every text component of the user DELTA OFF parcel curve label style with contents, height, colour, attachment, offsets, rotation and text style, plus the leader settings, so the style can be rebuilt in another drawing. No changes.

Script file
C3D-0092.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));
        Log("    Height      " + safe(() => c.Text.Height.Value.ToString()));
        Log("    Color       " + safe(() => c.Text.Color.Value.ToString()));
        Log("    Attachment  " + safe(() => c.Text.Attachment.Value.ToString()));
        Log("    Justify     " + safe(() => c.Text.Justification.Value.ToString()));
        Log("    XOffset     " + safe(() => c.Text.XOffset.Value.ToString()));
        Log("    YOffset     " + safe(() => c.Text.YOffset.Value.ToString()));
        Log("    Rotation    " + safe(() => c.Text.Rotation.Value.ToString()));
        Log("    TextStyle   " + safe(() => c.Text.TextStyle.Value.ToString()));
        Log("    MaxWidth    " + safe(() => c.Text.MaxWidth.Value.ToString()));
    }

    Log("");
    Log("  -- leader --");
    Log("    Visibility    " + safe(() => s.Properties.Leader.Visibility.Value.ToString()));
    Log("    ArrowheadStyle " + safe(() => s.Properties.Leader.ArrowheadStyle.Value));
    Log("    ArrowheadSize " + safe(() => s.Properties.Leader.ArrowheadSize.Value.ToString()));
    Log("    Shape         " + safe(() => s.Properties.Leader.Shape.Value.ToString()));
    Log("    Color         " + safe(() => s.Properties.Leader.Color.Value.ToString()));
    Log("    Lineweight    " + safe(() => s.Properties.Leader.Lineweight.Value.ToString()));
    Log("    Linetype      " + safe(() => s.Properties.Leader.Linetype.Value.ToString()));
}

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
Message
Compile error: (31,52): error CS1061: 'LabelStyleTextComponent.StyleText' does not contain a definition for 'Justification' and no accessible extension method 'Justification' accepting a first argument of type 'LabelStyleTextComponent.StyleText' could be found (are you missing a using directive or an assembly reference?); (34,52): error CS1061: 'LabelStyleTextComponent.StyleText' does not contain a definition for 'Rotation' and no accessible extension method 'Rotation' accepting a first argument of type 'LabelStyleTextComponent.StyleText' could be found (are you missing a using directive or an assembly reference?); (35,52): error CS1061: 'LabelStyleTextComponent.StyleText' does not contain a definition for 'TextStyle' and no accessible extension method 'TextStyle' accepting a first argument of type 'LabelStyleTextComponent.StyleText' could be found (are you missing a using directive or an assembly reference?)
Entities
Duration
344 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.