C3D-0216 · 260714 Huckaby: join the 5 driveway polylines into one done
Joins 20CC8 + 20CC9 + 20CE3 + 20CCB + 20CCA into a single polyline on X-DRIV-CONC. Every endpoint already coincides to 0.000 ft so no fuzz distance and no invented geometry. JoinEntity preserves bulges, so the arcs stay arcs. Reports vertex count, length and how many arc segments survived. Regen last.
C# payload
// 260714 - join the 5 driveway polylines into ONE. All endpoints already coincide to 0.000 ft
// (20CE3 is the 19.78 ft piece the user drew to bridge the last gap), so JoinEntity needs no
// fuzz and invents no geometry. Bulges are preserved by the join - arcs stay arcs.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
string[] hs = { "20CC8", "20CC9", "20CE3", "20CCB", "20CCA" };
Func<string, ObjectId> byHandle = h => {
ObjectId id;
return Db.TryGetObjectId(new Handle(Convert.ToInt64(h, 16)), out id) ? id : ObjectId.Null;
};
var baseId = byHandle(hs[0]);
if (baseId.IsNull) { Log("base handle not found"); return; }
var master = (Polyline)Tx.GetObject(baseId, OpenMode.ForWrite);
Log(string.Format("base [{0}] {1} verts, len {2:F2}", hs[0], master.NumberOfVertices, master.Length));
int joined = 0;
for (int i = 1; i < hs.Length; i++) {
var id = byHandle(hs[i]);
if (id.IsNull) { Log("missing: " + hs[i]); continue; }
var other = (Polyline)Tx.GetObject(id, OpenMode.ForWrite);
int before = master.NumberOfVertices;
try {
master.JoinEntity(other);
other.Erase();
joined++;
Log(string.Format("joined [{0}]: {1} -> {2} verts", hs[i], before, master.NumberOfVertices));
} catch (System.Exception ex) {
Log(string.Format("could NOT join [{0}]: {1}", hs[i], ex.Message));
}
}
var back = (Polyline)Tx.GetObject(baseId, OpenMode.ForRead);
int arcs = 0;
for (int i = 0; i < back.NumberOfVertices; i++)
if (Math.Abs(back.GetBulgeAt(i)) > 1e-9) arcs++;
Log(string.Format("RESULT [{0}]: {1} verts, len {2:F2}, closed={3}, layer {4}, {5} arc segments preserved (verified)",
back.Handle, back.NumberOfVertices, back.Length, back.Closed, back.Layer, arcs));
Log("joined " + joined + " of " + (hs.Length - 1));
Ed.Regen();
Result
Log
base [20CC8] 5 verts, len 123.12 joined [20CC9]: 5 -> 8 verts joined [20CE3]: 8 -> 9 verts joined [20CCB]: 9 -> 17 verts joined [20CCA]: 17 -> 23 verts RESULT [20CC8]: 23 verts, len 490.00, closed=True, layer X-DRIV-CONC, 6 arc segments preserved (verified) joined 4 of 4
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.