← Inbox

C3D-0180 · READ-ONLY: what layer do the map annotations use [ANNO-LAYERS] done

Groups every model-space text entity by layer with counts and samples including text height, and lists every layer whose name mentions boundary, land or lot with its state, to determine the layer convention the land lot markers should follow. No changes.

Script file
C3D-0180.cs
Target
active document · model space
Author
claude
Approved
yes · reviewer
Timeout
240s

C# payload

// READ-ONLY. What layer do the OTHER map annotations live on? Report every MText/DBText in model
// space grouped by layer, with a sample, so the land lot markers can be put on the same layer the
// rest of the annotation uses. Nothing is modified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("drawing: " + Db.Filename);

var byLayer = new Dictionary<string, List<string>>();
var counts = new Dictionary<string, int>();
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    string s = null; double h = 0;
    var mt = o as MText;  if (mt != null) { s = mt.Contents; h = mt.TextHeight; }
    var dt = o as DBText; if (dt != null) { s = dt.TextString; h = dt.Height; }
    if (s == null) continue;
    var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
    string lay; try { lay = ent.Layer; } catch { continue; }
    if (!counts.ContainsKey(lay)) { counts[lay] = 0; byLayer[lay] = new List<string>(); }
    counts[lay]++;
    if (byLayer[lay].Count < 3)
        byLayer[lay].Add(String.Format("h={0:F2} \"{1}\"", h,
            (s.Length > 55 ? s.Substring(0,55) + "..." : s).Replace("\n", " | ")));
}

Log("=== model-space text by layer ===");
var keys = new List<string>(counts.Keys);
keys.Sort();
foreach (var k in keys) {
    Log("");
    Log(String.Format("  {0,-28} {1} text entities", k, counts[k]));
    foreach (var s in byLayer[k]) Log("       " + s);
}

Log("");
Log("=== every layer whose name mentions BOUNDARY or LAND or LOT ===");
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
foreach (ObjectId lid in lt) {
    var l = (LayerTableRecord)Tx.GetObject(lid, OpenMode.ForRead);
    string u = l.Name.ToUpper();
    if (u.IndexOf("BOUNDARY") < 0 && u.IndexOf("LAND") < 0 && u.IndexOf("LOT") < 0) continue;
    int n = counts.ContainsKey(l.Name) ? counts[l.Name] : 0;
    Log(String.Format("  {0,-28} text={1,-4} off={2,-5} frozen={3,-5} color={4}",
        l.Name, n, l.IsOff, l.IsFrozen, l.Color));
}

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.dwg
Message
Executed C3D-0180 (0 entities touched).
Entities
Duration
566 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-C-Store Sewer As-Built.dwg
=== model-space text by layer ===

  C-ANNO                       1 text entities
       h=6.00 "{\fSimplex|b0|i1|c0|p2;WOOLFE CREEK DR | 40' R/W - UNPAVE..."

  LAND_LOT_LINE                2 text entities
       h=4.00 "L.L.\P3"
       h=4.00 "L.L.\P4"

  LAND_LOT_LINE_TEXT           1 text entities
       h=4.00 "APPROXIMATE LAND \PLOT LINE"

  SEWER_LINE_TEXT              1 text entities
       h=3.00 "55.14'"

  SEWER_LINE_TEXT E1           13 text entities
       h=3.02 "C-STORE"
       h=3.00 "132.52' - 8" PVC"
       h=3.00 "133.21' - 8" PVC"

  SEWER_LINE_TEXT E2           13 text entities
       h=3.00 "80.46' - 60' PVC / 20' DIP"
       h=3.00 "161.58' - 60' DIP / 100' PVC"
       h=3.00 "359.02' - 8" PVC"

  SEWER_MANHOLE_TEXT           7 text entities
       h=3.60 "\A1;"
       h=3.60 "\A1;"
       h=3.60 "\A1;"

  SEWER_MANHOLE_TEXT E1        5 text entities
       h=4.00 "MH  A16\PRIM  751.17\POUT  742.77"
       h=4.00 "MH  A14\PRIM  734.14\PIN   722.02\POUT  721.82"
       h=4.00 "MH  A12\PRIM  727.40\PIN   718.08\POUT  717.88"

  SEWER_MANHOLE_TEXT E2        7 text entities
       h=4.00 "MH  A6\PRIM  724.78\PIN   712.49\POUT  712.49"
       h=4.00 "MH  A5\PRIM  721.41\PIN   699.94\POUT  699.56"
       h=4.00 "MH  A4\PRIM  691.53\PIN   679.57\POUT  677.97"

  SS-0-FRAME                   7 text entities
       h=5.03 "FFE:728.5"
       h=3.02 "F.F.E.=728.50"
       h=4.00 "TEST MH\PRIM  727.72\PIN   719.83\POUT  719.73"

  V-CTRL-TEXT                  2 text entities
       h=4.00 "S43\U+00B0 30' 29"E 9725.42 TO CC HC07-06"
       h=4.00 "S12\U+00B0 39' 08"W 11339.24 TO CC HC07-05"

=== every layer whose name mentions BOUNDARY or LAND or LOT ===
  C-PROP-LOTS                  text=0    off=False frozen=False color=magenta
  SS-BOUNDARY BLUE             text=0    off=False frozen=False color=blue
  SS-BOUNDARY_PTS              text=0    off=False frozen=False color=red
  SS-BOUNDARY RED              text=0    off=False frozen=False color=red
  SS-BOUNDARY                  text=0    off=False frozen=True  color=red
  SS-BOUNDARY ANGEL            text=0    off=False frozen=False color=yellow
  SS-BUFFER LANDSCAPE          text=0    off=False frozen=False color=cyan
  BOUNDARY PTS                 text=0    off=False frozen=False color=white
  SS-BOUNDARY CYAN             text=0    off=False frozen=False color=cyan
  SS-BOUNDARY MAG              text=0    off=False frozen=False color=210
  LAND_LOT_LINE                text=2    off=False frozen=False color=white
  LAND_LOT_LINE_TEXT           text=1    off=False frozen=False color=white
  LOT_NUMBER_TEXT              text=0    off=False frozen=False color=white
  PROJECT_BOUNDARY             text=0    off=False frozen=False color=white
  PROJECT_BOUNDARY_TEXT        text=0    off=False frozen=False color=white
  WETLAND_BOUNDARY             text=0    off=False frozen=False color=cyan
  SS-BOUNDARY TRACT NF         text=0    off=False frozen=False color=magenta
  SS-BOUNDARY LAND LOT         text=0    off=False frozen=True  color=cyan
  BOUNDARY                     text=0    off=False frozen=False color=green

Notes

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

No notes yet.