← Inbox

C3D-0055 · READ-ONLY: re-check every manhole point and its layer [MH-RECHECK-2] done

Lists every CogoPoint whose description mentions MH/SSMH/MANHOLE individually with point number, description, layer, point style (resolved via StyleId) and coordinates, plus a per-layer tally. No changes.

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

C# payload

// READ-ONLY. Re-check every manhole point after the user's edits.
//
// Anything whose description mentions MH / SSMH / MANHOLE, listed individually with point number,
// description, layer, style and coordinates - so a wrong layer is visible per point rather than
// only per description group. Nothing is modified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

Func<Func<string>, string> safe = f => { try { return f(); } catch (System.Exception ex) { return "<" + ex.GetType().Name + ">"; } };

var rows = new List<string>();
var byLayer = new Dictionary<string,int>();
int n = 0;

foreach (ObjectId id in ms) {
    CogoPoint cp = null;
    try { cp = Tx.GetObject(id, OpenMode.ForRead) as CogoPoint; } catch { continue; }
    if (cp == null) continue;

    string d = safe(() => (cp.RawDescription ?? "")).Trim();
    string u = d.ToUpper();
    if (u.IndexOf("MH") < 0 && u.IndexOf("MANHOLE") < 0) continue;
    n++;

    string lay = safe(() => cp.Layer);
    if (!byLayer.ContainsKey(lay)) byLayer[lay] = 0;
    byLayer[lay]++;

    // CogoPoint has no StyleName (cookbook 17) - resolve the style record through StyleId
    string sty = safe(() => {
        var so = Tx.GetObject(cp.StyleId, OpenMode.ForRead);
        return ((SymbolTableRecord)so).Name;
    });
    rows.Add(String.Format("  pt {0,-6} {1,-22} layer={2,-24} style={3,-18} {4}",
        safe(() => cp.PointNumber.ToString()),
        d,
        lay,
        sty,
        safe(() => String.Format("{0:F2},{1:F2}", cp.Easting, cp.Northing))));
}

rows.Sort();
Log("=== ALL MANHOLE POINTS (" + n + ") ===");
foreach (var r in rows) Log(r);

Log("");
Log("=== by layer ===");
foreach (var kv in byLayer) Log("  " + kv.Key + " : " + kv.Value);

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
Message
Executed C3D-0055 (0 entities touched).
Entities
Duration
364 ms
Civil 3D
25.0.0.0

Log

=== ALL MANHOLE POINTS (15) ===
  pt 344    SSMH A9                layer=SEWER_MANHOLE            style=<Exception>        2296714.07,1280025.30
  pt 352    SSMH A10               layer=SEWER_MANHOLE            style=<Exception>        2296690.96,1280045.90
  pt 353    SSMH TEST MH           layer=SEWER_MANHOLE            style=<Exception>        2296685.19,1280052.35
  pt 358    SSMH TEST MH           layer=SEWER_MANHOLE            style=<Exception>        2296651.99,1280058.10
  pt 377    SSMH A12               layer=SEWER_MANHOLE            style=<Exception>        2296604.65,1280046.20
  pt 378    SSMH A6                layer=SEWER_MANHOLE            style=<Exception>        2296827.25,1280095.99
  pt 379    SSMH A5                layer=SEWER_MANHOLE            style=<Exception>        2296878.69,1280034.22
  pt 380    SSMH A4                layer=SEWER_MANHOLE            style=<Exception>        2296980.45,1279912.31
  pt 381    SSMH A3                layer=SEWER_MANHOLE            style=<Exception>        2297249.93,1279675.24
  pt 382    SSMH A2                layer=SEWER_MANHOLE            style=<Exception>        2297269.03,1279597.72
  pt 383    SSMH A1                layer=SEWER_MANHOLE            style=<Exception>        2297422.96,1279618.78
  pt 384    SSMH MAIN              layer=SEWER_MANHOLE_EXISTING   style=<Exception>        2297424.71,1279599.32
  pt 390    EX_MH                  layer=SEWER_MANHOLE_EXISTING   style=<Exception>        2296655.81,1279977.60
  pt 424    SSMH A14               layer=SEWER_MANHOLE            style=<Exception>        2296511.25,1279951.45
  pt 473    SSMH A16               layer=SEWER_MANHOLE            style=<Exception>        2296379.85,1279953.52

=== by layer ===
  SEWER_MANHOLE : 13
  SEWER_MANHOLE_EXISTING : 2

Notes

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

No notes yet.