C3D-LW-SIDEWALK · Linework: sidewalk done
47 surveyed points chained nearest-neighbour, breaking the run at a 60ft gap -> 3 polyline(s). Layer SS-ROAD-SIDEWALK.
C# payload
// SIDEWALK linework -> SS-ROAD-SIDEWALK
// 47 surveyed points chained nearest-neighbour, breaking the run at a 60ft 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-SIDEWALK";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 4);
{
var pl = new Polyline();
pl.AddVertexAt(0, new Point2d(2296557.37, 1280266.12), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296557.29, 1280256.18), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296585.51, 1280255.72), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296584.75, 1280265.71), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 737.53;
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(2296590.56, 1280136.58), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296595.08, 1280136.55), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296590.59, 1280131.47), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296603.9, 1280136.58), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296619.72, 1280136.67), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296626.92, 1280136.56), 0, 0, 0);
pl.AddVertexAt(6, new Point2d(2296627.22, 1280136.49), 0, 0, 0);
pl.AddVertexAt(7, new Point2d(2296635.49, 1280136.56), 0, 0, 0);
pl.AddVertexAt(8, new Point2d(2296643.61, 1280136.61), 0, 0, 0);
pl.AddVertexAt(9, new Point2d(2296652.52, 1280136.54), 0, 0, 0);
pl.AddVertexAt(10, new Point2d(2296654.22, 1280136.49), 0, 0, 0);
pl.AddVertexAt(11, new Point2d(2296654.31, 1280141.23), 0, 0, 0);
pl.AddVertexAt(12, new Point2d(2296660.31, 1280141.36), 0, 0, 0);
pl.AddVertexAt(13, new Point2d(2296660.19, 1280136.39), 0, 0, 0);
pl.AddVertexAt(14, new Point2d(2296661.95, 1280136.5), 0, 0, 0);
pl.AddVertexAt(15, new Point2d(2296670.85, 1280136.59), 0, 0, 0);
pl.AddVertexAt(16, new Point2d(2296678.8, 1280136.43), 0, 0, 0);
pl.AddVertexAt(17, new Point2d(2296687.22, 1280136.39), 0, 0, 0);
pl.AddVertexAt(18, new Point2d(2296695.54, 1280136.34), 0, 0, 0);
pl.AddVertexAt(19, new Point2d(2296703.81, 1280136.5), 0, 0, 0);
pl.AddVertexAt(20, new Point2d(2296712.03, 1280136.56), 0, 0, 0);
pl.AddVertexAt(21, new Point2d(2296720.32, 1280136.39), 0, 0, 0);
pl.AddVertexAt(22, new Point2d(2296723.07, 1280136.42), 0, 0, 0);
pl.AddVertexAt(23, new Point2d(2296722.98, 1280140.25), 0, 0, 0);
pl.AddVertexAt(24, new Point2d(2296728.0, 1280140.28), 0, 0, 0);
pl.AddVertexAt(25, new Point2d(2296728.0, 1280136.62), 0, 0, 0);
pl.AddVertexAt(26, new Point2d(2296727.97, 1280136.45), 0, 0, 0);
pl.AddVertexAt(27, new Point2d(2296722.98, 1280131.71), 0, 0, 0);
pl.AddVertexAt(28, new Point2d(2296727.78, 1280095.97), 0, 0, 0);
pl.AddVertexAt(29, new Point2d(2296722.54, 1280091.12), 0, 0, 0);
pl.AddVertexAt(30, new Point2d(2296715.96, 1280090.97), 0, 0, 0);
pl.AddVertexAt(31, new Point2d(2296714.63, 1280082.05), 0, 0, 0);
pl.AddVertexAt(32, new Point2d(2296713.19, 1280081.12), 0, 0, 0);
pl.AddVertexAt(33, new Point2d(2296710.17, 1280078.99), 0, 0, 0);
pl.AddVertexAt(34, new Point2d(2296707.21, 1280077.76), 0, 0, 0);
pl.AddVertexAt(35, new Point2d(2296691.92, 1280077.44), 0, 0, 0);
pl.AddVertexAt(36, new Point2d(2296654.18, 1280077.57), 0, 0, 0);
pl.AddVertexAt(37, new Point2d(2296617.82, 1280077.63), 0, 0, 0);
pl.AddVertexAt(38, new Point2d(2296603.34, 1280077.76), 0, 0, 0);
pl.AddVertexAt(39, new Point2d(2296594.37, 1280082.5), 0, 0, 0);
pl.AddVertexAt(40, new Point2d(2296590.22, 1280077.63), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 728.53;
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(2296748.26, 1280252.73), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296743.82, 1280264.95), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 733.03;
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-SIDEWALK now holds " + n + " polyline(s) (verified)");
Result
Log
run 1: 4 verts, 48.2 ft run 2: 41 verts, 361.9 ft run 3: 2 verts, 13.0 ft SS-ROAD-SIDEWALK now holds 3 polyline(s) (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.