← Inbox

C3D-0295 · 260612 C-Store H2O: find the water/meter/BFP labels in model space done

READ-ONLY. Lists every model-space text mentioning meter/BFP/RPZ/fire/dom/water/vault/valve with handle, layer and position, to map the redline items onto real entities.

Script file
C3D-0295.cs
Target
260612-C-Store Sewer As-Built 60 H2O.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// READ-ONLY: every text entity in MODEL SPACE mentioning meters/BFP/RPZ/fire/dom/water, with
// position and layer, so the redline items can be mapped to real entities.
Log("drawing: " + Db.Filename);
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
string[] keys = { "METER", "BFP", "RPZ", "FIRE", "DOM", "WATER", "DIP", "PVC", "VAULT", "HYD", "WV", "VALVE", "TAP" };
foreach (ObjectId id in ms) {
    var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;
    string txt = null; double x = 0, y = 0, h = 0;
    var dt = ent as DBText;
    if (dt != null) { txt = dt.TextString; x = dt.Position.X; y = dt.Position.Y; h = dt.Height; }
    var mt = ent as MText;
    if (mt != null) { txt = mt.Contents; x = mt.Location.X; y = mt.Location.Y; h = mt.TextHeight; }
    if (txt == null) continue;
    string up = txt.ToUpper();
    bool hit = false;
    foreach (var k in keys) if (up.Contains(k)) { hit = true; break; }
    if (!hit) continue;
    Log(string.Format("[{0}] {1,-6} h={2:F2} layer={3,-24} ({4:F1},{5:F1}) \"{6}\"",
        ent.Handle, ent.GetType().Name == "DBText" ? "TEXT" : "MTEXT", h, ent.Layer, x, y,
        txt.Replace("\n", " / ").Substring(0, Math.Min(90, txt.Length))));
}

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 H2O.dwg
Message
Executed C3D-0295 (0 entities touched).
Entities
Duration
374 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 60 H2O.dwg
[2EF4F] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E1       (2296447.5,1279953.4) "132.52' - 8" PVC"
[2EF50] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E1       (2296558.0,1280000.0) "133.21' - 8" PVC"
[2EF52] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E1       (2296633.5,1280041.7) "86.31' - 8" PVC"
[2EF54] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E1       (2296753.6,1280051.3) "133.46' - 8" PVC"
[2EF55] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E2       (2296849.3,1280061.1) "80.46' - 60' PVC / 20' DIP"
[2EF56] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E2       (2296931.1,1279974.5) "161.58' - 60' DIP / 100' PVC"
[2EF57] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E2       (2297116.5,1279795.3) "359.02' - 8" PVC"
[2EF58] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E2       (2297261.4,1279637.0) "80.02' - DIP"
[2EF59] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E2       (2297305.8,1279604.5) "155.37' - 8" PVC"
[2F76B] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E1       (2296709.0,1280042.9) "8" PVC"
[2F7B8] MTEXT  h=3.00 layer=SEWER_LINE_TEXT E2       (2297433.0,1279610.5) "PVC"

Notes

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

No notes yet.