C3D-LW-DUMPSTER · Linework: dumpster done
6 surveyed points chained nearest-neighbour, breaking the run at a 100ft gap -> 1 polyline(s). Layer SS-ROAD-DUMPSTER.
C# payload
// DUMPSTER linework -> SS-ROAD-DUMPSTER
// 6 surveyed points chained nearest-neighbour, breaking the run at a 100ft gap -> 1 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-DUMPSTER";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 33);
{
var pl = new Polyline();
pl.AddVertexAt(0, new Point2d(2296604.0, 1280078.42), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296596.65, 1280068.23), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296610.6, 1280058.44), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296613.05, 1280061.77), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296614.2, 1280063.16), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296617.63, 1280068.68), 0, 0, 0);
pl.Closed = true;
pl.Elevation = 728.43;
pl.Layer = LAYER;
ms.AppendEntity(pl);
Tx.AddNewlyCreatedDBObject(pl, true);
Log(" run 1: " + 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-DUMPSTER now holds " + n + " polyline(s) (verified)");
Result
Log
run 1: 6 verts, 58.8 ft SS-ROAD-DUMPSTER now holds 1 polyline(s) (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.