← Inbox

C3D-0239 · 260612 Springdale: list text styles and what the notes use done

READ-ONLY. Every TextStyleTableRecord with its font file/TTF, plus a count of which styles the drawing text actually uses and any legal-description-like text found.

Script file
C3D-0239.cs
Target
260612-Springdale Sanitary Sewer Extension As-Built 60.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// READ-ONLY: every text style in the drawing and what it maps to, plus which styles the
// existing notes/certificate text actually use.
var tst = (TextStyleTable)Tx.GetObject(Db.TextStyleTableId, OpenMode.ForRead);
Log("=== TEXT STYLES ===");
foreach (ObjectId id in tst) {
    var ts = (TextStyleTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    string bigf = string.IsNullOrEmpty(ts.BigFontFileName) ? "" : "  bigfont=" + ts.BigFontFileName;
    string tt = "";
    try { tt = string.IsNullOrEmpty(ts.Font.TypeFace) ? "" : "  TTF=\"" + ts.Font.TypeFace + "\""; } catch { }
    Log(string.Format("{0,-22} file={1,-16} h={2:F3} width={3:F3}{4}{5}",
        ts.Name, ts.FileName, ts.TextSize, ts.XScale, tt, bigf));
}
Log("");
Log("=== WHAT THE NOTES USE ===");
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var counts = new Dictionary<string,int>();
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    foreach (ObjectId id in btr) {
        Autodesk.AutoCAD.DatabaseServices.DBObject o;
        try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
        string sty = null; string sample = null;
        var mt = o as MText;
        if (mt != null) {
            var st = (TextStyleTableRecord)Tx.GetObject(mt.TextStyleId, OpenMode.ForRead);
            sty = st.Name; sample = mt.Contents;
        }
        var dt = o as DBText;
        if (dt != null) {
            var st = (TextStyleTableRecord)Tx.GetObject(dt.TextStyleId, OpenMode.ForRead);
            sty = st.Name; sample = dt.TextString;
        }
        if (sty == null) continue;
        if (!counts.ContainsKey(sty)) counts[sty] = 0;
        counts[sty]++;
        // surface the legal-ish text
        if (sample != null && (sample.ToUpper().Contains("BEGINNING") || sample.ToUpper().Contains("THENCE")
            || sample.ToUpper().Contains("CERTIF") || sample.ToUpper().Contains("DESCRIPTION")))
            Log(string.Format("  [{0}] style={1} \"{2}\"", ((Autodesk.AutoCAD.DatabaseServices.Entity)o).Handle,
                sty, sample.Replace("\n"," ").Substring(0, Math.Min(70, sample.Length))));
    }
}
Log("");
foreach (var kv in counts) Log(string.Format("  style {0,-22} used by {1} text objects", kv.Key, kv.Value));

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-C-Store Sewer As-Built 60.dwg
Message
Executed C3D-0239 (0 entities touched).
Entities
Duration
2218 ms
Civil 3D
25.0.0.0

Log

=== TEXT STYLES ===
Standard               file=simplex.shx      h=0.000 width=1.000
                       file=ltypeshp.shx     h=0.000 width=1.000
Annotative             file=                 h=0.000 width=1.000
SHR                    file=SIMPLEX          h=0.750 width=1.000
S4                     file=simplex          h=0.056 width=1.000
L120                   file=simplex.shx      h=12.000 width=1.000
ROMAND                 file=romand.shx       h=0.125 width=1.000
SIMPLEX                file=romanc.shx       h=3.200 width=1.000
CBL                    file=ROMANS           h=0.023 width=1.000
DIM                    file=ic-dim.shx       h=0.000 width=1.000
NEWSTYLE5              file=ic-dim.shx       h=0.000 width=1.000
BLOCK$0$DIM            file=ic-dim.shx       h=0.000 width=1.000
L100                   file=simplex          h=5.000 width=1.000
ARIAL                  file=swissb.ttf       h=0.000 width=1.000  TTF="Swis721 BT"
L30                    file=simplex.shx      h=3.000 width=0.850
L60                    file=simplex.shx      h=3.000 width=0.800
L20                    file=simplex.shx      h=2.000 width=1.000
anno-0.08              file=times.ttf        h=0.080 width=1.000  TTF="Times New Roman"
LABELS                 file=times.ttf        h=0.000 width=1.000  TTF="Times New Roman"
ARCH-1                 file=arch-1.shx       h=0.000 width=1.000
BP                     file=BKANT.TTF        h=0.000 width=1.000  TTF="Book Antiqua"
L50                    file=simplex          h=1.000 width=1.000
CADdetails-DIMENSIONS  file=ARIALN.TTF       h=2.380 width=1.000  TTF="Arial Narrow"
                       file=GRCV.shx         h=0.000 width=1.000
UTILITY                file=romans.shx       h=0.000 width=1.000
ARCHSING               file=archsing         h=0.000 width=1.000
ARCHCHIS               file=archchis         h=0.000 width=2.000
linetype               file=simplex.shx      h=0.000 width=1.000
OpenSans               file=OpenSans-Regular.ttf h=0.000 width=1.000
OpenSansCondensed-Light file=OpenSansCondensed-Light.ttf h=0.000 width=1.000
Verdana                file=verdana.ttf      h=0.000 width=1.000  TTF="Verdana"
TITLE20                file=BKANT.TTF        h=0.079 width=1.000  TTF="Book Antiqua"
GF_050                 file=arial.ttf        h=0.197 width=1.000  TTF="Arial"
HL-HD                  file=j:\LIBRARY\FONTS\bold.shx h=0.020 width=1.000
PDF Arial Narrow Italic file=ARIALNI.TTF      h=0.000 width=1.000  TTF="Arial Narrow"
PDF ArialMT            file=arial.ttf        h=0.000 width=1.000  TTF="Arial"
PDF Arial Narrow       file=ARIALN.TTF       h=0.000 width=1.000  TTF="Arial Narrow"
PDF Century Gothic     file=GOTHIC.TTF       h=0.000 width=1.000  TTF="Century Gothic"
PDF BankGothicBT-Light file=arial.ttf        h=0.000 width=1.000  TTF="Arial"
PDF Arial-BoldMT       file=arial.ttf        h=0.000 width=1.000  TTF="Arial"
ROMANC                 file=romanc.shx       h=3.000 width=1.000
Legend                 file=calibri.ttf      h=0.000 width=1.000  TTF="Calibri"

=== WHAT THE NOTES USE ===
  [2E8FB] style=SIMPLEX "SURVEYOR'S CERTIFICATE\P\PIt is hereby certified that this As-Built Su"
  [1452C] style=SIMPLEX "IPF IRON PIN FOUND \PIPS IRON PIN SET\PR/W RIGHT OF WAY\PRWM RIGHT OF "
  [2EB48] style=SIMPLEX "IPF IRON PIN FOUND \PIPP IRON PIN PROPOSED\PR/W RIGHT OF WAY\P\PMAG MA"
  [2867D] style=PDF ArialMT "CERTIFIED WITH ALL PUBLIC LINES AND METERS BEING DEEDED OVER TO HCWA."

  style PDF Arial Narrow       used by 88 text objects
  style PDF ArialMT            used by 97 text objects
  style SIMPLEX                used by 82 text objects
  style Standard               used by 97 text objects
  style L120                   used by 7 text objects
  style DIM                    used by 7 text objects
  style ROMAND                 used by 29 text objects
  style SHR                    used by 14 text objects
  style S4                     used by 3 text objects
  style L60                    used by 1 text objects
  style CBL                    used by 5 text objects
  style ARIAL                  used by 12 text objects
  style HL-HD                  used by 17 text objects
  style TITLE20                used by 23 text objects
  style PDF Arial Narrow Italic used by 35 text objects
  style PDF Century Gothic     used by 3 text objects
  style PDF BankGothicBT-Light used by 1 text objects
  style PDF Arial-BoldMT       used by 3 text objects
  style ROMANC                 used by 12 text objects

Notes

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

No notes yet.