C3D-0478 · JOIN V-DWY and V-WALK polylines (preserve arcs) 260904 [C3D-0480] done
Use Polyline.JoinEntity to merge the multiple V-DWY and V-WALK polylines into one each, keeping existing bulges/arcs. No vertex rewrite.
C# payload
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForWrite);
foreach(string layer in new[]{"V-DWY","V-WALK"}){
var pls=new System.Collections.Generic.List<ObjectId>();
foreach(ObjectId eid in ms){ var pl=Tx.GetObject(eid,OpenMode.ForRead) as Polyline; if(pl!=null&&pl.Layer==layer) pls.Add(eid); }
if(pls.Count<2){ Log(layer+": "+pls.Count+" poly, nothing to join"); continue; }
var master=(Polyline)Tx.GetObject(pls[0],OpenMode.ForWrite);
var rest=new System.Collections.Generic.List<Autodesk.AutoCAD.DatabaseServices.Entity>();
for(int i=1;i<pls.Count;i++) rest.Add((Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(pls[i],OpenMode.ForWrite));
int joined=0;
foreach(var e in rest){ try{ master.JoinEntity(e); joined++; }catch(System.Exception ex){ Log(layer+" join fail: "+ex.Message); } }
// erase the now-merged sources
foreach(var e in rest){ if(!e.IsErased) e.Erase(); }
Log(layer+": joined "+joined+"/"+(pls.Count-1)+" -> master v="+master.NumberOfVertices+" closed="+master.Closed+" h="+master.Handle);
}
Ed.Regen();
Result
Log
V-DWY: joined 2/2 -> master v=18 closed=True h=2106C V-WALK join fail: eNotApplicable V-WALK: joined 0/1 -> master v=9 closed=True h=21073
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.