C3DO-0826 · 261103 linework: TBC curb (SS-V-ROAD-CURB) [C3D-LW1103-CURB] done
Draws the TBC curb from the 261103 field points as regular Polylines on SS-V-ROAD-CURB: side rd W curb + return 102-106-110-111-112-113-114-115-116-117-118-119; side rd E curb to dwy 100-104-107; side rd E curb from dwy + return 108-133-134-135-136-137-138-139; island 127-132-131-130-129-128; WSR N curb return 186-185-184-183; WSR N curb 179-178-177-176. Skips if that layer already has linework in the 261103 area.
C# payload
string F(double v)=>v.ToString("0.###");
ObjectId H(string h)=>Db.GetObjectId(false,new Handle(Convert.ToInt64(h,16)),0);
ObjectId Lyr(string name,short c){ var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead); if(lt.Has(name)) return lt[name]; lt.UpgradeOpen(); var r=new LayerTableRecord{Name=name,Color=Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci,c)}; var id=lt.Add(r); Tx.AddNewlyCreatedDBObject(r,true); Log("layer created "+name); return id; }
ObjectId Put(BlockTableRecord btr, Autodesk.AutoCAD.DatabaseServices.Entity e, string layer){ e.SetDatabaseDefaults(Db); e.Layer=layer; var id=btr.AppendEntity(e); Tx.AddNewlyCreatedDBObject(e,true); return id; }
var LM=LayoutManager.Current;
BlockTableRecord PS(string name){ var l=(Layout)Tx.GetObject(LM.GetLayoutId(name),OpenMode.ForRead); return (BlockTableRecord)Tx.GetObject(l.BlockTableRecordId,OpenMode.ForWrite); }
var BT=(BlockTable)Tx.GetObject(Db.BlockTableId,OpenMode.ForRead);
var MS=(BlockTableRecord)Tx.GetObject(BT[BlockTableRecord.ModelSpace],OpenMode.ForWrite);
bool HasText(BlockTableRecord btr,string contains){ foreach(ObjectId id in btr){ var o=Tx.GetObject(id,OpenMode.ForRead); if(o is MText m && m.Contents.Contains(contains)) return true; if(o is DBText t && t.TextString.Contains(contains)) return true; } return false; }
// 261103 linework from field points (WALT STEPHENS RD.txt): TBC curb on SS-V-ROAD-CURB. Regular Polylines, elevation 0.
const string LAYER="SS-V-ROAD-CURB";
var RUNS=new (string name,bool closed,Point2d[] pts)[]{
("side rd W curb + return (102-106-110-111-112-113-114-115-116-117-118-119)", false, new[]{new Point2d(2271482.9561,1283303.9348),new Point2d(2271473.5813,1283341.9721),new Point2d(2271461.0780,1283377.7788),new Point2d(2271450.7412,1283406.1884),new Point2d(2271440.9072,1283439.5864),new Point2d(2271439.2291,1283445.1365),new Point2d(2271435.9325,1283451.4273),new Point2d(2271430.4015,1283457.1650),new Point2d(2271422.7164,1283461.1214),new Point2d(2271415.3461,1283462.0769),new Point2d(2271407.1819,1283460.5281),new Point2d(2271376.5777,1283451.7550)}),
("side rd E curb to dwy (100-104-107)", false, new[]{new Point2d(2271510.7652,1283308.9210),new Point2d(2271506.6212,1283340.5492),new Point2d(2271503.0295,1283359.1000)}),
("side rd E curb from dwy + return (108-133-134-135-136-137-138-139)", false, new[]{new Point2d(2271499.3210,1283380.1398),new Point2d(2271497.6533,1283423.1595),new Point2d(2271487.3312,1283458.4687),new Point2d(2271485.8682,1283466.9980),new Point2d(2271486.6399,1283472.8513),new Point2d(2271491.0215,1283481.8118),new Point2d(2271496.8933,1283487.3795),new Point2d(2271502.3026,1283490.2797)}),
("island (127-132-131-130-129-128)", true, new[]{new Point2d(2271456.8990,1283473.7168),new Point2d(2271463.4696,1283469.6383),new Point2d(2271470.8504,1283444.4855),new Point2d(2271468.2364,1283435.4263),new Point2d(2271461.7391,1283439.1651),new Point2d(2271454.2863,1283464.5737)}),
("WSR N curb return (186-185-184-183)", false, new[]{new Point2d(2271664.4688,1283590.4720),new Point2d(2271670.3468,1283593.0031),new Point2d(2271675.0115,1283595.9892),new Point2d(2271682.1158,1283603.8915)}),
("WSR N curb (179-178-177-176)", false, new[]{new Point2d(2271728.3338,1283613.1929),new Point2d(2271736.1244,1283612.1243),new Point2d(2271744.9881,1283613.4347),new Point2d(2271756.8536,1283616.9849)}),
};
Lyr(LAYER,7);
// idempotent: skip if this layer already has linework inside the 261103 point area
int have=0; foreach(ObjectId id in MS){ if(Tx.GetObject(id,OpenMode.ForRead) is Curve c && c.Layer==LAYER){ try{ var e=c.GeometricExtents; if(e.MaxPoint.X>2271300&&e.MinPoint.X<2272000&&e.MaxPoint.Y>1283250&&e.MinPoint.Y<1283700) have++; }catch{} } }
if(have>0){ Log(LAYER+" already has "+have+" curves in the 261103 area - nothing drawn"); Ed.Regen(); return; }
foreach(var r in RUNS){
var pl=new Polyline(); for(int i=0;i<r.pts.Length;i++) pl.AddVertexAt(i,r.pts[i],0,0,0); pl.Closed=r.closed;
Put(MS,pl,LAYER); Log(r.name+": "+pl.NumberOfVertices+" v, "+F(pl.Length)+"'"+(r.closed?" closed":"")+" ("+pl.Handle+")");
}
Ed.Regen();
Result
Log
side rd W curb + return (102-106-110-111-112-113-114-115-116-117-118-119): 12 v, 219.242' (21FF5) side rd E curb to dwy (100-104-107): 3 v, 50.794' (21FF6) side rd E curb from dwy + return (108-133-134-135-136-137-138-139): 8 v, 118.601' (21FF7) island (127-132-131-130-129-128): 6 v, 86.86' closed (21FF8) WSR N curb return (186-185-184-183): 4 v, 22.565' (21FF9) WSR N curb (179-178-177-176): 4 v, 29.209' (21FFA)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.