← Inbox

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.

Script file
C3D-0478.cs
Target
260904 - 920 W Sandtown Rd SW.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

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

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260904 - 920 W Sandtown Rd SW, Marietta, GA 30064, USA\260904 - 920 W Sandtown Rd SW.dwg
Message
Executed C3D-0478 (0 entities touched).
Entities
Duration
585 ms
Civil 3D
25.0.0.0

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.