C3D-0590 · Linework: WALK on X-WALK [C3D-0587] done
Sidewalk SW 310-322 (closed, 4 ft wide, notch at CB 327) -> X-WALK. Points: 310,311,312,313,314,315,316,317,318,319,320,321,322
C# payload
var LAYER="X-WALK";
var pts=new Point2d[]{new Point2d(2333887.2700,1492054.0600),new Point2d(2333891.9400,1492046.4600),new Point2d(2333898.4600,1492036.0600),new Point2d(2333910.1500,1492015.6300),new Point2d(2333921.5400,1491995.9100),new Point2d(2333924.9500,1491997.9800),new Point2d(2333922.7500,1492001.7400),new Point2d(2333919.1000,1492004.3600),new Point2d(2333916.3100,1492008.3800),new Point2d(2333918.3000,1492009.6700),new Point2d(2333900.5900,1492040.4800),new Point2d(2333895.2700,1492048.7100),new Point2d(2333893.5300,1492051.0800)};
var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead);
if(!lt.Has(LAYER)){ lt.UpgradeOpen(); var nl=new LayerTableRecord(); nl.Name=LAYER; nl.Color=Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci,7); lt.Add(nl); Tx.AddNewlyCreatedDBObject(nl,true); Log("created layer "+LAYER); }
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForWrite);
bool dup=false;
foreach(ObjectId id in ms){ var pl=Tx.GetObject(id,OpenMode.ForRead) as Polyline; if(pl!=null && pl.Layer==LAYER && pl.NumberOfVertices==pts.Length && pl.GetPoint2dAt(0).GetDistanceTo(pts[0])<0.01) dup=true; }
if(dup){ Log("SKIP - already drawn on "+LAYER); }
else {
var p=new Polyline(); p.SetDatabaseDefaults(); p.Layer=LAYER;
for(int i=0;i<pts.Length;i++) p.AddVertexAt(i,pts[i],0,0,0);
p.Closed=true;
var id=ms.AppendEntity(p); Tx.AddNewlyCreatedDBObject(p,true);
var rb=(Polyline)Tx.GetObject(id,OpenMode.ForRead);
Log("WALK: h="+rb.Handle+" layer="+rb.Layer+" nv="+rb.NumberOfVertices+" closed="+rb.Closed+" len="+rb.Length.ToString("F1")+(rb.Closed?" area="+rb.Area.ToString("F0"):"")+" (verified)");
}
Ed.Regen();
Result
Log
created layer X-WALK WALK: h=2129D layer=X-WALK nv=13 closed=True len=142.8 area=247 (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.