C3D-LW-BUILDING · Linework: building done
9 surveyed points chained nearest-neighbour, breaking the run at a 200ft gap -> 1 polyline(s). Layer SS-ROAD-BUILDING.
C# payload
// BUILDING linework -> SS-ROAD-BUILDING
// 9 surveyed points chained nearest-neighbour, breaking the run at a 200ft 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-BUILDING";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 6);
{
var pl = new Polyline();
pl.AddVertexAt(0, new Point2d(2296563.12, 1280064.91), 0, 0, 0);
pl.AddVertexAt(1, new Point2d(2296595.39, 1280069.34), 0, 0, 0);
pl.AddVertexAt(2, new Point2d(2296594.37, 1280082.5), 0, 0, 0);
pl.AddVertexAt(3, new Point2d(2296654.18, 1280077.57), 0, 0, 0);
pl.AddVertexAt(4, new Point2d(2296714.63, 1280082.05), 0, 0, 0);
pl.AddVertexAt(5, new Point2d(2296715.57, 1280082.51), 0, 0, 0);
pl.AddVertexAt(6, new Point2d(2296715.96, 1280090.97), 0, 0, 0);
pl.AddVertexAt(7, new Point2d(2296722.54, 1280091.12), 0, 0, 0);
pl.AddVertexAt(8, new Point2d(2296722.98, 1280131.71), 0, 0, 0);
pl.Closed = true;
pl.Elevation = 728.73;
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-BUILDING now holds " + n + " polyline(s) (verified)");
Result
Log
run 1: 9 verts, 396.3 ft SS-ROAD-BUILDING now holds 1 polyline(s) (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.