← Inbox

C3D-0591 · Linework: TBC-W on X-ROAD-CURB [C3D-0587] done

West curb TBC 323,324,325,326,328 -> X-ROAD-CURB. Points: 323,324,325,326,328

Script file
C3D-0591.cs
Target
261001 - 5040 Rolling Rock Dr.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

var LAYER="X-ROAD-CURB";
var pts=new Point2d[]{new Point2d(2333897.8000,1492047.6700),new Point2d(2333902.0900,1492041.9100),new Point2d(2333910.8700,1492026.5700),new Point2d(2333919.8700,1492010.6500),new Point2d(2333929.7000,1491993.6400)};
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=false;
  var id=ms.AppendEntity(p); Tx.AddNewlyCreatedDBObject(p,true);
  var rb=(Polyline)Tx.GetObject(id,OpenMode.ForRead);
  Log("TBC-W: 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

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261001 - 5040 Rolling Rock Dr, Sugar Hill, GA 30518, USA\261001 - 5040 Rolling Rock Dr.dwg
Message
Executed C3D-0591 (0 entities touched).
Entities
—
Duration
549 ms
Civil 3D
25.0.0.0

Log

TBC-W: h=2129F layer=X-ROAD-CURB nv=5 closed=False len=62.8 (verified)

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.