← Inbox

C3D-LW-CONCRETE · Linework: concrete done

50 surveyed points chained nearest-neighbour, breaking the run at a 80ft gap -> 3 polyline(s). Layer SS-ROAD-CONCRETE.

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

C# payload

// CONCRETE linework -> SS-ROAD-CONCRETE
// 50 surveyed points chained nearest-neighbour, breaking the run at a 80ft gap -> 3 polyline(s).
// Regular Polyline only (never Polyline3d - cookbook 11); elevation = mean of each run.
// Host owns Tx; host regens after commit.
const string LAYER = "SS-ROAD-CONCRETE";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 8);

    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296400.55, 1280014.96), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296400.66, 1280022.72), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296413.42, 1280022.93), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296417.27, 1280022.02), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296417.05, 1280027.89), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296425.52, 1280028.38), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296425.63, 1280022.51), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296413.52, 1280015.06), 0, 0, 0);
        pl.Closed = false;
        pl.Elevation = 746.34;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 1: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296577.06, 1280053.71), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296596.55, 1280067.88), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296610.07, 1280058.46), 0, 0, 0);
        pl.Closed = false;
        pl.Elevation = 728.27;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 2: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296679.61, 1280015.76), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296702.22, 1280051.95), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296694.82, 1280058.34), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296715.57, 1280082.51), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296730.96, 1280084.17), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296732.76, 1280086.78), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296733.42, 1280090.71), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296741.72, 1280081.75), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296747.84, 1280099.84), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296747.8, 1280099.93), 0, 0, 0);
        pl.AddVertexAt(10, new Point2d(2296749.52, 1280104.34), 0, 0, 0);
        pl.AddVertexAt(11, new Point2d(2296753.83, 1280110.49), 0, 0, 0);
        pl.AddVertexAt(12, new Point2d(2296759.84, 1280115.91), 0, 0, 0);
        pl.AddVertexAt(13, new Point2d(2296764.8, 1280119.58), 0, 0, 0);
        pl.AddVertexAt(14, new Point2d(2296739.06, 1280136.35), 0, 0, 0);
        pl.AddVertexAt(15, new Point2d(2296739.05, 1280136.36), 0, 0, 0);
        pl.AddVertexAt(16, new Point2d(2296735.57, 1280130.97), 0, 0, 0);
        pl.AddVertexAt(17, new Point2d(2296733.99, 1280125.78), 0, 0, 0);
        pl.AddVertexAt(18, new Point2d(2296739.49, 1280154.31), 0, 0, 0);
        pl.AddVertexAt(19, new Point2d(2296720.49, 1280154.53), 0, 0, 0);
        pl.AddVertexAt(20, new Point2d(2296712.4, 1280154.53), 0, 0, 0);
        pl.AddVertexAt(21, new Point2d(2296704.05, 1280154.43), 0, 0, 0);
        pl.AddVertexAt(22, new Point2d(2296695.25, 1280154.54), 0, 0, 0);
        pl.AddVertexAt(23, new Point2d(2296687.26, 1280154.4), 0, 0, 0);
        pl.AddVertexAt(24, new Point2d(2296678.93, 1280154.4), 0, 0, 0);
        pl.AddVertexAt(25, new Point2d(2296670.47, 1280154.5), 0, 0, 0);
        pl.AddVertexAt(26, new Point2d(2296661.56, 1280154.68), 0, 0, 0);
        pl.AddVertexAt(27, new Point2d(2296601.38, 1280181.78), 0, 0, 0);
        pl.AddVertexAt(28, new Point2d(2296600.99, 1280205.63), 0, 0, 0);
        pl.AddVertexAt(29, new Point2d(2296584.4, 1280230.79), 0, 0, 0);
        pl.AddVertexAt(30, new Point2d(2296582.58, 1280231.09), 0, 0, 0);
        pl.AddVertexAt(31, new Point2d(2296582.51, 1280233.93), 0, 0, 0);
        pl.AddVertexAt(32, new Point2d(2296584.29, 1280233.91), 0, 0, 0);
        pl.AddVertexAt(33, new Point2d(2296641.09, 1280225.24), 0, 0, 0);
        pl.AddVertexAt(34, new Point2d(2296642.21, 1280243.86), 0, 0, 0);
        pl.AddVertexAt(35, new Point2d(2296680.45, 1280243.71), 0, 0, 0);
        pl.AddVertexAt(36, new Point2d(2296678.89, 1280221.33), 0, 0, 0);
        pl.AddVertexAt(37, new Point2d(2296728.58, 1280205.25), 0, 0, 0);
        pl.AddVertexAt(38, new Point2d(2296728.75, 1280181.38), 0, 0, 0);
        pl.Closed = false;
        pl.Elevation = 728.71;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 3: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }

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("SS-ROAD-CONCRETE now holds " + n + " polyline(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-CONCRETE (0 entities touched).
Entities
Duration
352 ms
Civil 3D
25.0.0.0

Log

  run 1: 8 verts, 58.9 ft
  run 2: 3 verts, 40.6 ft
  run 3: 39 verts, 653.8 ft
SS-ROAD-CONCRETE now holds 3 polyline(s) (verified)

Notes

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

No notes yet.