C3D-LW-TAP · Linework: tap done
7 surveyed points chained nearest-neighbour, breaking the run at a 120ft gap -> 1 polyline(s). Layer SEWER_TAP.
C# payload
// TAP linework -> SEWER_TAP
// 7 surveyed points chained nearest-neighbour, breaking the run at a 120ft 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 = "SEWER_TAP";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 3);
{
var pl = new Polyline();
pl.AddVertexAt(0, new Point2d(2296688.73, 1280080.25), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296628.18, 1280057.93), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296622.0, 1280055.89), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296607.71, 1280064.06), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296598.96, 1280075.58), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296598.58, 1280075.62), 0, 0, 0);
pl.AddVertexAt(6, new Point2d(2296550.11, 1280052.8), 0, 0, 0);
pl.Closed = false;
pl.Elevation = 728.54;
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("SEWER_TAP now holds " + n + " polyline(s) (verified)");
Result
Log
run 1: 7 verts, 155.9 ft SEWER_TAP now holds 1 polyline(s) (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.