← Inbox

C3D-0082 · READ-ONLY: read inside the two parcel curve label styles [CURVE-STYLE-INSIDE] error

Reads the actual text components, their content templates, heights, colours and offsets, plus the leader arrowhead settings, inside Delta over Length and Radius and Standard - the style name does not have to match what it emits. No changes.

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

C# payload

// READ-ONLY. Look INSIDE the two parcel curve label styles. The style NAME does not have to
// describe what it emits - "Delta over Length and Radius" may have been edited to produce the
// ARC / CHD / bearing / RAD format. Read the actual text components and the leader settings.
// Nothing is modified.
var civil = CivilApplication.ActiveDocument;
Func<Func<string>, string> safe = f => { try { return f(); } catch (System.Exception ex) { return "<" + ex.GetType().Name + ">"; } };

foreach (ObjectId sid in civil.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles) {
    var st = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
    if (st == null) continue;
    Log("");
    Log("=== STYLE \"" + safe(() => st.Name) + "\" ===");

    // every text component and its content template - this is the format itself
    try {
        var comps = st.GetComponents(Autodesk.Civil.DatabaseServices.Styles.LabelStyleComponentType.Text);
        Log("  text components: " + comps.Count);
        foreach (ObjectId cid in comps) {
            var c = Tx.GetObject(cid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent;
            if (c == null) continue;
            Log("   * \"" + safe(() => c.Name) + "\"");
            Log("       Contents  " + safe(() => c.Text.Contents.Value));
            Log("       Height    " + safe(() => c.Text.Height.Value.ToString()));
            Log("       Color     " + safe(() => c.Text.Color.Value.ToString()));
            Log("       Attach    " + safe(() => c.Text.Attachment.Value.ToString()));
            Log("       XOffset   " + safe(() => c.Text.XOffset.Value.ToString()));
            Log("       YOffset   " + safe(() => c.Text.YOffset.Value.ToString()));
        }
    } catch (System.Exception ex) { Log("  components: " + ex.Message); }

    // leader settings
    try {
        Log("  -- leader --");
        Log("       Visible   " + safe(() => st.Properties.Leader.Visible.Value.ToString()));
        Log("       ArrowType " + safe(() => st.Properties.Leader.ArrowheadType.Value.ToString()));
        Log("       ArrowSize " + safe(() => st.Properties.Leader.ArrowheadSize.Value.ToString()));
        Log("       Color     " + safe(() => st.Properties.Leader.Color.Value.ToString()));
        Log("       Shape     " + safe(() => st.Properties.Leader.Shape.Value.ToString()));
    } catch (System.Exception ex) { Log("  leader: " + ex.Message); }
}

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: (34,67): error CS1061: 'LabelStyleBase.BaseLeader' does not contain a definition for 'Visible' and no accessible extension method 'Visible' accepting a first argument of type 'LabelStyleBase.BaseLeader' could be found (are you missing a using directive or an assembly reference?); (35,67): error CS1061: 'LabelStyleBase.BaseLeader' does not contain a definition for 'ArrowheadType' and no accessible extension method 'ArrowheadType' accepting a first argument of type 'LabelStyleBase.BaseLeader' could be found (are you missing a using directive or an assembly reference?)
Entities
Duration
830 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.