← Inbox

C3D-0025 · 30ft sewer easement from the main run [EASE-30] done

Offsets the sewer main run 15ft each side to form the 30ft easement on SEWER_EASEMENT. The three test-MH connector branches are excluded. Uses GetOffsetCurves so corners mitre correctly.

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

C# payload

// 30ft sewer easement: offset the sewer MAIN RUN 15ft each side.
//
// The main run is the 11 chained lines 473 -> 424 -> A12 -> A10 -> A9 -> A6 -> A5 -> A4 -> A3
// -> A2 -> A1 -> MAIN (1368.01 ft). The three TEST-MH CONNECTOR branches are deliberately EXCLUDED
// per the user ("the CL is not all the line ... the test MH connectors are not included"):
//     h=2E95F  12.07ft stub off 358
//     h=2EC88  55.14ft into 377 from the NW
//     h=2EC92   8.66ft 353 -> A10
//
// Builds the centerline as one polyline, then uses Polyline.GetOffsetCurves(+/-15.0) so the
// corner mitres are handled properly rather than offsetting each segment independently.
// The centerline itself is NOT drawn - only the two easement edges.
// Host owns Tx; host regens after commit.
const string LAYER = "SEWER_EASEMENT";
const double HALF = 15.0;

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.AddVertexAt(2, new Point2d(2296604.65, 1280046.2), 0, 0, 0);
    pl.AddVertexAt(3, new Point2d(2296690.96, 1280045.9), 0, 0, 0);
    pl.AddVertexAt(4, new Point2d(2296714.07, 1280025.3), 0, 0, 0);
    pl.AddVertexAt(5, new Point2d(2296827.25, 1280095.99), 0, 0, 0);
    pl.AddVertexAt(6, new Point2d(2296878.69, 1280034.22), 0, 0, 0);
    pl.AddVertexAt(7, new Point2d(2296980.45, 1279912.31), 0, 0, 0);
    pl.AddVertexAt(8, new Point2d(2297249.93, 1279675.24), 0, 0, 0);
    pl.AddVertexAt(9, new Point2d(2297269.03, 1279597.72), 0, 0, 0);
    pl.AddVertexAt(10, new Point2d(2297422.96, 1279618.78), 0, 0, 0);
    pl.AddVertexAt(11, new Point2d(2297424.71, 1279599.32), 0, 0, 0);

double centreLen = pl.Length;

int made = 0;
foreach (double d in new double[] { HALF, -HALF })
{
    try {
        var curves = pl.GetOffsetCurves(d);
        foreach (Autodesk.AutoCAD.DatabaseServices.Entity oe in curves)
        {
            oe.Layer = LAYER;
            ms.AppendEntity(oe);
            Tx.AddNewlyCreatedDBObject(oe, true);
            var opl = oe as Polyline;
            Log("  offset " + d.ToString("F1") + " -> " + (opl != null ? opl.NumberOfVertices + " verts, " +
                opl.Length.ToString("F2") + " ft" : oe.GetType().Name));
            made++;
        }
    } catch (System.Exception ex) { Log("  offset " + d + " FAILED: " + ex.Message); }
}
pl.Dispose();

Log("centerline " + centreLen.ToString("F2") + " ft (main run only, connectors excluded)");
Log("drew " + made + " easement edge(s) at +/-" + HALF.ToString("F1") + " ft = " + (HALF*2).ToString("F0") + " ft easement");

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-0025 (0 entities touched).
Entities
Duration
397 ms
Civil 3D
25.0.0.0

Log

  offset 15.0 -> 12 verts, 1341.66 ft
  offset -15.0 -> 12 verts, 1394.37 ft
centerline 1368.01 ft (main run only, connectors excluded)
drew 2 easement edge(s) at +/-15.0 ft = 30 ft easement

Notes

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

No notes yet.