← Inbox

C3D-HCWA-MHFIX · HCWA fix: symbolize 2 missing manholes done

10 SSMH points were surveyed but only 8 drawn. Adds circles + text for #101 and #102 (HCWA requires every manhole symbolized). Line 4 terminates on #101.

Script file
C3D-HCWA-MHFIX.cs
Target
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\CSTORE WATER ABS-260612_SHEET.dwg · model space
Author
claude
Approved
yes · sanjay (batch-approved: HCWA migration)
Timeout
60s

C# payload

// HCWA fix: 2 surveyed manholes (#101, #102) have no drawn symbol. HCWA requires every manhole
// symbolized with a circle centered exactly on the tangent endpoint. Adds them at r=2.00 to match
// the existing 8, plus their SEWER_MANHOLE_TEXT labels. Idempotent.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
foreach (var n in new[]{"SEWER_MANHOLE","SEWER_MANHOLE_TEXT"})
    if (!lt.Has(n)) { Log($"ABORT: layer '{n}' missing."); return; }

var have = new List<Point2d>();
foreach (ObjectId id in ms) { var o = Tx.GetObject(id, OpenMode.ForRead);
    if (o is Circle c && c.Layer == "SEWER_MANHOLE") have.Add(new Point2d(c.Center.X, c.Center.Y)); }

int added = 0;
foreach (ObjectId id in CivilDoc.CogoPoints) {
    var cp = (Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id, OpenMode.ForRead);
    var code = (cp.RawDescription ?? "").Trim();
    if (!code.ToUpperInvariant().Contains("SSMH")) continue;
    var p = new Point2d(cp.Easting, cp.Northing);
    double bd = double.MaxValue;
    foreach (var h in have) { double d = p.GetDistanceTo(h); if (d < bd) bd = d; }
    if (bd <= 1.0) continue;                                  // already symbolized

    var c = new Circle(new Point3d(p.X, p.Y, 0), Vector3d.ZAxis, 2.00) { Layer = "SEWER_MANHOLE" };
    ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true);

    var t = new DBText {
        Position = new Point3d(p.X + 3.0, p.Y + 2.0, 0),
        TextString = $"SSMH {cp.PointNumber}",
        Height = 4.50, Layer = "SEWER_MANHOLE_TEXT"
    };
    ms.AppendEntity(t); Tx.AddNewlyCreatedDBObject(t, true);
    // second line carries the surveyed rim/invert note verbatim
    var t2 = new DBText {
        Position = new Point3d(p.X + 3.0, p.Y - 4.0, 0),
        TextString = code, Height = 3.80, Layer = "SEWER_MANHOLE_TEXT"
    };
    ms.AppendEntity(t2); Tx.AddNewlyCreatedDBObject(t2, true);

    var chk = (Circle)Tx.GetObject(c.ObjectId, OpenMode.ForRead);
    Log($"  added SSMH #{cp.PointNumber} '{code}' @({p.X:F2},{p.Y:F2}) r={chk.Radius:F2} layer={chk.Layer} (verified)");
    added++;
}
Log($"MANHOLE SYMBOLS ADDED: {added}. All surveyed SSMH points are now symbolized.");

Result

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

Log

  added SSMH #101 'SSMH MD 21.95' @(2296877.74,1280034.32) r=2.00 layer=SEWER_MANHOLE (verified)
  added SSMH #102 'SSMH MD 13.96 WATER' @(2296981.39,1279913.29) r=2.00 layer=SEWER_MANHOLE (verified)
MANHOLE SYMBOLS ADDED: 2. All surveyed SSMH points are now symbolized.

Notes

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

No notes yet.