C3D-LW-EP · Linework: ep done
70 surveyed points chained nearest-neighbour, breaking the run at a 120ft gap -> 4 polyline(s). Layer ROAD_EDGE_OF_PAVEMENT.
C# payload
// EP linework -> ROAD_EDGE_OF_PAVEMENT
// 70 surveyed points chained nearest-neighbour, breaking the run at a 120ft gap -> 4 polyline(s).
// Regular Polyline only (never Polyline3d - cookbook 11); elevation = mean of each run.
// Host owns Tx; host regens after commit.
const string LAYER = "ROAD_EDGE_OF_PAVEMENT";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 8);
{
var pl = new Polyline();
pl.AddVertexAt(0, new Point2d(2296318.02, 1279919.77), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296359.13, 1279911.42), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296363.42, 1279929.09), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296325.37, 1279962.46), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296330.08, 1280015.76), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296373.9, 1280013.66), 0, 0, 0);
pl.AddVertexAt(6, new Point2d(2296370.93, 1280037.04), 0, 0, 0);
pl.AddVertexAt(7, new Point2d(2296366.11, 1280063.31), 0, 0, 0);
pl.AddVertexAt(8, new Point2d(2296368.3, 1280100.45), 0, 0, 0);
pl.AddVertexAt(9, new Point2d(2296327.15, 1280097.58), 0, 0, 0);
pl.AddVertexAt(10, new Point2d(2296328.08, 1280063.22), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 749.01;
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(2296369.24, 1280210.17), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296369.9, 1280217.44), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296383.36, 1280256.89), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296391.99, 1280267.92), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296409.92, 1280281.24), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296436.41, 1280290.08), 0, 0, 0);
pl.AddVertexAt(6, new Point2d(2296453.99, 1280290.34), 0, 0, 0);
pl.AddVertexAt(7, new Point2d(2296558.11, 1280277.94), 0, 0, 0);
pl.AddVertexAt(8, new Point2d(2296577.05, 1280226.64), 0, 0, 0);
pl.AddVertexAt(9, new Point2d(2296570.5, 1280221.13), 0, 0, 0);
pl.AddVertexAt(10, new Point2d(2296564.87, 1280209.79), 0, 0, 0);
pl.AddVertexAt(11, new Point2d(2296562.19, 1280200.69), 0, 0, 0);
pl.AddVertexAt(12, new Point2d(2296557.85, 1280200.47), 0, 0, 0);
pl.AddVertexAt(13, new Point2d(2296588.88, 1280154.49), 0, 0, 0);
pl.AddVertexAt(14, new Point2d(2296661.56, 1280154.68), 0, 0, 0);
pl.AddVertexAt(15, new Point2d(2296670.47, 1280154.5), 0, 0, 0);
pl.AddVertexAt(16, new Point2d(2296678.93, 1280154.4), 0, 0, 0);
pl.AddVertexAt(17, new Point2d(2296687.26, 1280154.4), 0, 0, 0);
pl.AddVertexAt(18, new Point2d(2296695.25, 1280154.54), 0, 0, 0);
pl.AddVertexAt(19, new Point2d(2296704.05, 1280154.43), 0, 0, 0);
pl.AddVertexAt(20, new Point2d(2296712.4, 1280154.53), 0, 0, 0);
pl.AddVertexAt(21, new Point2d(2296720.49, 1280154.53), 0, 0, 0);
pl.AddVertexAt(22, new Point2d(2296739.49, 1280154.31), 0, 0, 0);
pl.AddVertexAt(23, new Point2d(2296739.05, 1280136.36), 0, 0, 0);
pl.AddVertexAt(24, new Point2d(2296739.06, 1280136.35), 0, 0, 0);
pl.AddVertexAt(25, new Point2d(2296735.57, 1280130.97), 0, 0, 0);
pl.AddVertexAt(26, new Point2d(2296733.99, 1280125.78), 0, 0, 0);
pl.AddVertexAt(27, new Point2d(2296733.42, 1280090.71), 0, 0, 0);
pl.AddVertexAt(28, new Point2d(2296732.76, 1280086.78), 0, 0, 0);
pl.AddVertexAt(29, new Point2d(2296730.96, 1280084.17), 0, 0, 0);
pl.AddVertexAt(30, new Point2d(2296702.22, 1280051.95), 0, 0, 0);
pl.AddVertexAt(31, new Point2d(2296695.92, 1280057.13), 0, 0, 0);
pl.AddVertexAt(32, new Point2d(2296613.05, 1280061.77), 0, 0, 0);
pl.AddVertexAt(33, new Point2d(2296610.07, 1280058.46), 0, 0, 0);
pl.AddVertexAt(34, new Point2d(2296564.13, 1280056.05), 0, 0, 0);
pl.AddVertexAt(35, new Point2d(2296562.3, 1280056.16), 0, 0, 0);
pl.AddVertexAt(36, new Point2d(2296559.81, 1280014.14), 0, 0, 0);
pl.AddVertexAt(37, new Point2d(2296557.87, 1280014.02), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 731.65;
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(2296641.09, 1280225.24), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296642.21, 1280243.86), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296680.45, 1280243.71), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296678.89, 1280221.33), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296728.58, 1280205.25), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296728.75, 1280181.38), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 729.49;
pl.Layer = LAYER;
ms.AppendEntity(pl);
Tx.AddNewlyCreatedDBObject(pl, true);
Log(" run 3: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
}
{
var pl = new Polyline();
pl.AddVertexAt(0, new Point2d(2296816.39, 1280275.0), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296816.5, 1280274.91), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296809.16, 1280287.35), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296833.57, 1280277.55), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296840.86, 1280279.76), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296866.17, 1280286.58), 0, 0, 0);
pl.AddVertexAt(6, new Point2d(2296867.3, 1280286.71), 0, 0, 0);
pl.AddVertexAt(7, new Point2d(2296884.45, 1280286.56), 0, 0, 0);
pl.AddVertexAt(8, new Point2d(2296898.03, 1280286.47), 0, 0, 0);
pl.AddVertexAt(9, new Point2d(2296961.71, 1280286.01), 0, 0, 0);
pl.AddVertexAt(10, new Point2d(2296965.04, 1280286.02), 0, 0, 0);
pl.AddVertexAt(11, new Point2d(2296965.32, 1280367.57), 0, 0, 0);
pl.AddVertexAt(12, new Point2d(2296974.06, 1280367.44), 0, 0, 0);
pl.AddVertexAt(13, new Point2d(2296902.21, 1280368.36), 0, 0, 0);
pl.AddVertexAt(14, new Point2d(2296902.16, 1280368.34), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 729.62;
pl.Layer = LAYER;
ms.AppendEntity(pl);
Tx.AddNewlyCreatedDBObject(pl, true);
Log(" run 4: " + 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("ROAD_EDGE_OF_PAVEMENT now holds " + n + " polyline(s) (verified)");
Result
Log
run 1: 11 verts, 371.2 ft run 2: 38 verts, 834.2 ft run 3: 6 verts, 155.4 ft run 4: 15 verts, 335.8 ft ROAD_EDGE_OF_PAVEMENT now holds 4 polyline(s) (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.