← Inbox

C3D-LW-SEWER · Linework: sewer tangents done

Draws 15 sewer tangents on SEWER_LINE_EXISTING, one line per manhole-to-manhole run, each digitised uphill to downhill per HCWA Rev 1.6. 25 SSMH shots collapsed to 16 unique structures.

Script file
C3D-LW-SEWER.cs
Target
SS_BLOCK_22X17 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// Sewer linework -> SEWER_LINE_EXISTING, drawn to the HCWA rules.
//
// HCWA Rev 1.6 requires:
//   * all tangents between sewer manholes drawn with a SINGLE line - a line must not continue
//     for more than one tangent
//   * lines digitised from the UPHILL node to the DOWNHILL node
//   * tangents snapped at endpoints, at the exact centre of the manhole, no gaps
//
// The 25 SSMH/MH shots collapse to 16 unique structures (duplicate shots of the same manhole
// within 1ft were merged - e.g. 377/389/812 are all one structure). Manholes were chained by
// proximity starting from the highest rim, then EACH tangent oriented uphill -> downhill from
// the surveyed rim elevations. Every tangent falls, none rise. One >500ft jump was dropped as
// not being a real tangent.
//
// Regular Polyline, 2 points per tangent (cookbook 11). Host owns Tx; host regens after commit.
const string LAYER = "SEWER_LINE_EXISTING";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 3);

    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296379.85, 1279953.52), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296511.25, 1279951.45), 0, 0, 0);
        pl.Elevation = 751.17;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 1: 131.4 ft, rim 751.17 -> 734.14 (fall 17.03)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296511.25, 1279951.45), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296604.65, 1280046.2), 0, 0, 0);
        pl.Elevation = 734.14;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 2: 133.0 ft, rim 734.14 -> 727.40 (fall 6.74)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296651.99, 1280058.1), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296604.65, 1280046.2), 0, 0, 0);
        pl.Elevation = 727.72;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 3: 48.8 ft, rim 727.72 -> 727.40 (fall 0.32)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296651.99, 1280058.1), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296685.19, 1280052.35), 0, 0, 0);
        pl.Elevation = 727.72;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 4: 33.7 ft, rim 727.72 -> 727.68 (fall 0.04)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296685.19, 1280052.35), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296690.96, 1280045.9), 0, 0, 0);
        pl.Elevation = 727.68;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 5: 8.7 ft, rim 727.68 -> 727.55 (fall 0.13)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296690.96, 1280045.9), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296714.07, 1280025.3), 0, 0, 0);
        pl.Elevation = 727.55;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 6: 31.0 ft, rim 727.55 -> 726.97 (fall 0.58)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296714.07, 1280025.3), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296655.81, 1279977.6), 0, 0, 0);
        pl.Elevation = 726.97;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 7: 75.3 ft, rim 726.97 -> 726.49 (fall 0.48)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296655.81, 1279977.6), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296827.25, 1280095.99), 0, 0, 0);
        pl.Elevation = 726.49;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 8: 208.3 ft, rim 726.49 -> 724.78 (fall 1.71)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296827.25, 1280095.99), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296877.74, 1280034.32), 0, 0, 0);
        pl.Elevation = 724.78;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 9: 79.7 ft, rim 724.78 -> 721.43 (fall 3.35)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296877.74, 1280034.32), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296981.39, 1279913.29), 0, 0, 0);
        pl.Elevation = 721.43;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 10: 159.3 ft, rim 721.43 -> 691.24 (fall 30.19)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296980.45, 1279912.31), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296981.39, 1279913.29), 0, 0, 0);
        pl.Elevation = 691.53;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 11: 1.4 ft, rim 691.53 -> 691.24 (fall 0.29)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296980.45, 1279912.31), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2297249.93, 1279675.24), 0, 0, 0);
        pl.Elevation = 691.53;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 12: 358.9 ft, rim 691.53 -> 682.92 (fall 8.61)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2297269.03, 1279597.72), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2297249.93, 1279675.24), 0, 0, 0);
        pl.Elevation = 688.37;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 13: 79.8 ft, rim 688.37 -> 682.92 (fall 5.45)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2297269.03, 1279597.72), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2297422.96, 1279618.78), 0, 0, 0);
        pl.Elevation = 688.37;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 14: 155.4 ft, rim 688.37 -> 687.05 (fall 1.32)");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2297422.96, 1279618.78), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2297424.71, 1279599.32), 0, 0, 0);
        pl.Elevation = 687.05;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  tangent 15: 19.5 ft, rim 687.05 -> 686.70 (fall 0.35)");
    }

int n = 0;
foreach (ObjectId id in ms) {
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e != null && e.Layer == LAYER && e is Polyline) n++;
}
Log("SEWER_LINE_EXISTING now holds " + n + " tangent(s) (verified)");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\SS_BLOCK_22X17.dwg
Message
Executed C3D-LW-SEWER (0 entities touched).
Entities
Duration
307 ms
Civil 3D
25.0.0.0

Log

  tangent 1: 131.4 ft, rim 751.17 -> 734.14 (fall 17.03)
  tangent 2: 133.0 ft, rim 734.14 -> 727.40 (fall 6.74)
  tangent 3: 48.8 ft, rim 727.72 -> 727.40 (fall 0.32)
  tangent 4: 33.7 ft, rim 727.72 -> 727.68 (fall 0.04)
  tangent 5: 8.7 ft, rim 727.68 -> 727.55 (fall 0.13)
  tangent 6: 31.0 ft, rim 727.55 -> 726.97 (fall 0.58)
  tangent 7: 75.3 ft, rim 726.97 -> 726.49 (fall 0.48)
  tangent 8: 208.3 ft, rim 726.49 -> 724.78 (fall 1.71)
  tangent 9: 79.7 ft, rim 724.78 -> 721.43 (fall 3.35)
  tangent 10: 159.3 ft, rim 721.43 -> 691.24 (fall 30.19)
  tangent 11: 1.4 ft, rim 691.53 -> 691.24 (fall 0.29)
  tangent 12: 358.9 ft, rim 691.53 -> 682.92 (fall 8.61)
  tangent 13: 79.8 ft, rim 688.37 -> 682.92 (fall 5.45)
  tangent 14: 155.4 ft, rim 688.37 -> 687.05 (fall 1.32)
  tangent 15: 19.5 ft, rim 687.05 -> 686.70 (fall 0.35)
SEWER_LINE_EXISTING now holds 15 tangent(s) (verified)

Notes

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

No notes yet.