← Inbox

C3D-0228 · 260612 Springdale: read manhole coords + SEWER_LINE geometry done

READ-ONLY. Coordinates for every sewer manhole point and the SEWER_LINE segments, to compute stationing for a profile view.

Script file
C3D-0228.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 sewer manhole CogoPoint with coordinates, plus the SEWER_LINE geometry.
var cdoc = CivilApplication.ActiveDocument;
Log("=== SEWER MANHOLES ===");
foreach (ObjectId id in cdoc.CogoPoints) {
    var p = Tx.GetObject(id, OpenMode.ForRead) as CogoPoint;
    if (p == null) continue;
    string d = (p.RawDescription ?? "").ToUpper();
    if (!d.Contains("SSMH") && !d.Contains("MH")) continue;
    Log(string.Format("PT|{0}|{1}|{2:F4}|{3:F4}|{4:F3}|{5}",
        p.PointNumber, p.RawDescription, p.Northing, p.Easting, p.Elevation, p.Layer));
}
Log("=== SEWER_LINE GEOMETRY ===");
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    var ent = o as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;
    if (!ent.Layer.StartsWith("SEWER_LINE")) continue;
    var ln = ent as Line;
    if (ln != null) {
        Log(string.Format("LINE|{0}|{1}|{2:F4}|{3:F4}|{4:F4}|{5:F4}|{6:F2}",
            ent.Handle, ent.Layer, ln.StartPoint.Y, ln.StartPoint.X, ln.EndPoint.Y, ln.EndPoint.X, ln.Length));
        continue;
    }
    var pl = ent as Polyline;
    if (pl != null) {
        Log(string.Format("POLY|{0}|{1}|verts={2}|len={3:F2}", ent.Handle, ent.Layer, pl.NumberOfVertices, pl.Length));
        for (int i = 0; i < pl.NumberOfVertices; i++) {
            var v = pl.GetPoint2dAt(i);
            Log(string.Format("   v{0}|{1:F4}|{2:F4}", i, v.Y, v.X));
        }
    }
}

Result

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

Log

=== SEWER MANHOLES ===
PT|344|SSMH A9|1280025.2984|2296714.0671|726.966|SEWER_MANHOLE E1
PT|352|SSMH A10|1280045.9011|2296690.9556|727.553|SEWER_MANHOLE E1
PT|353|SSMH TEST MH|1280052.3550|2296685.1868|727.685|SEWER_MANHOLE E1
PT|358|SSMH TEST MH|1280058.1029|2296651.9910|727.722|SEWER_MANHOLE E1
PT|377|SSMH A12|1280046.2021|2296604.6474|727.398|SEWER_MANHOLE E1
PT|378|SSMH A6|1280095.9942|2296827.2479|724.782|SEWER_MANHOLE
PT|379|SSMH A5|1280034.2165|2296878.6917|721.412|SEWER_MANHOLE
PT|380|SSMH A4|1279912.3101|2296980.4511|691.527|SEWER_MANHOLE
PT|381|SSMH A3|1279675.2411|2297249.9295|682.940|SEWER_MANHOLE
PT|382|SSMH A2|1279597.7235|2297269.0339|688.330|SEWER_MANHOLE
PT|383|SSMH A1|1279618.7760|2297422.9615|687.053|SEWER_MANHOLE
PT|384|SSMH MAIN|1279599.3218|2297424.7074|686.701|SEWER_MANHOLE_EXISTING
PT|424|SSMH A14|1279951.4504|2296511.2511|734.137|SEWER_MANHOLE E1
PT|473|SSMH A16|1279953.5248|2296379.8453|751.174|SEWER_MANHOLE E1
=== SEWER_LINE GEOMETRY ===
LINE|2E95F|SEWER_LINE E1|1280058.1029|2296651.9910|1280046.0371|2296651.9693|12.07
LINE|2EC86|SEWER_LINE E1|1279953.5248|2296379.8453|1279951.4504|2296511.2511|132.52
LINE|2EC87|SEWER_LINE E1|1279951.4504|2296511.2511|1280046.2021|2296604.6474|133.21
LINE|2EC88|SEWER_LINE E1|1280052.7751|2296549.9350|1280046.2021|2296604.6474|55.14
LINE|2EC89|SEWER_LINE E1|1280046.2021|2296604.6474|1280045.9011|2296690.9556|86.31
LINE|2EC8A|SEWER_LINE E1|1280045.9011|2296690.9556|1280025.2984|2296714.0671|30.97
LINE|2EC8B|SEWER_LINE E1|1280025.2984|2296714.0671|1280095.9942|2296827.2479|133.46
LINE|2EC8C|SEWER_LINE|1280095.9942|2296827.2479|1280034.2165|2296878.6917|80.46
LINE|2EC8D|SEWER_LINE|1280034.2165|2296878.6917|1279912.3101|2296980.4511|161.58
LINE|2EC8E|SEWER_LINE|1279912.3101|2296980.4511|1279675.2411|2297249.9295|359.02
LINE|2EC8F|SEWER_LINE|1279675.2411|2297249.9295|1279597.7235|2297269.0339|80.02
LINE|2EC90|SEWER_LINE|1279597.7235|2297269.0339|1279618.7760|2297422.9615|155.37
LINE|2EC91|SEWER_LINE|1279618.7760|2297422.9615|1279599.3218|2297424.7074|19.54
LINE|2EC92|SEWER_LINE E1|1280052.3550|2296685.1868|1280045.9011|2296690.9556|8.66

Notes

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

No notes yet.