C3D-0705 · 261101 linework: curbs (TBC) [C3D-LW-CURB] done
8 polylines on SS-V-ROAD-CURB from the field points (point numbers in the log). Re-running skips any already drawn. Linetype scale 0.5.
C# payload
var LAYER="SS-V-ROAD-CURB";
var lid=EnsureLayer(LAYER,3);
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForWrite);
Func<Polyline,string> sig=pl=>{ var s=new System.Text.StringBuilder(); for(int i=0;i<pl.NumberOfVertices;i++){ var p=pl.GetPoint2dAt(i); s.Append(p.X.ToString("F2")+","+p.Y.ToString("F2")+";"); } return s.ToString()+(pl.Closed?"C":"O"); };
var have=new System.Collections.Generic.HashSet<string>();
foreach(ObjectId id in ms){ var pl=Tx.GetObject(id,OpenMode.ForRead) as Polyline; if(pl!=null&&pl.Layer==LAYER) have.Add(sig(pl)); }
var polys=new double[][]{ new double[]{2232324.1506,1420441.6740,2232323.3062,1420464.9567},new double[]{2232328.0378,1420472.2980,2232330.3856,1420472.5275,2232333.7269,1420471.6899,2232335.4376,1420469.4932,2232335.7663,1420467.3624},new double[]{2232329.5267,1420497.1645,2232332.0223,1420498.2046,2232334.3001,1420501.2068,2232334.7788,1420502.5435,2232334.6483,1420505.8043},new double[]{2232322.4752,1420502.9088,2232316.5955,1420526.0597,2232306.7438,1420563.3538,2232305.2093,1420609.5723,2232304.3053,1420631.6922},new double[]{2232332.5659,1420573.0397,2232332.2502,1420581.1624,2232330.3353,1420603.6098},new double[]{2232524.5755,1420563.9444,2232525.7216,1420562.4653,2232527.3537,1420562.3008,2232538.7500,1420563.1090},new double[]{2232428.0836,1420494.6511,2232428.1115,1420498.8414,2232442.6207,1420499.3261,2232445.1154,1420497.7615,2232442.9382,1420495.2713},new double[]{2232434.1903,1420462.0929,2232461.2380,1420465.0663,2232467.0262,1420465.4974,2232522.7600,1420471.8329,2232536.2434,1420475.1231} };
var closed=new bool[]{ false,false,false,false,false,false,true,false };
var notes=new string[]{ "Roswell Rd east curb, south of drive 1 (pts 258-257)","drive 1 return (pts 253-252-251-250-249)","drive 2 return (pts 266-267-268-269-270)","Roswell Rd east curb, north of drive 2 (pts 262-273-282-284-290)","curb at DI 277 (pts 276-278-279)","east island (pts 103-102-101-100)","island (pts 184-185-186-188-187)","south parking curb along wall (pts 223-217-216-212-205)" };
int made=0, skipped=0;
for(int k=0;k<polys.Length;k++){
var v=polys[k]; var pl=new Polyline(); pl.SetDatabaseDefaults();
for(int i=0;i<v.Length/2;i++) pl.AddVertexAt(i,new Point2d(v[2*i],v[2*i+1]),0,0,0);
pl.Closed=closed[k]; pl.LayerId=lid; pl.LinetypeScale=0.5;
if(have.Contains(sig(pl))){ skipped++; pl.Dispose(); continue; }
ms.AppendEntity(pl); Tx.AddNewlyCreatedDBObject(pl,true); made++;
Log(notes[k]+": "+pl.NumberOfVertices+" vertices"+(pl.Closed?", closed":"")+", "+pl.Length.ToString("F1")+" ft ["+pl.Handle+"]");
}
int onLayer=0; foreach(ObjectId id in ms){ var pl=Tx.GetObject(id,OpenMode.ForRead) as Polyline; if(pl!=null&&pl.Layer==LAYER) onLayer++; }
Log(LAYER+": "+made+" new, "+skipped+" already there, "+onLayer+" polylines on the layer now (verified)");
Ed.Regen();
Result
Log
Roswell Rd east curb, south of drive 1 (pts 258-257): 2 vertices, 23.3 ft [2142D] drive 1 return (pts 253-252-251-250-249): 5 vertices, 10.7 ft [2142E] drive 2 return (pts 266-267-268-269-270): 5 vertices, 11.2 ft [2142F] Roswell Rd east curb, north of drive 2 (pts 262-273-282-284-290): 5 vertices, 130.8 ft [21430] curb at DI 277 (pts 276-278-279): 3 vertices, 30.7 ft [21431] east island (pts 103-102-101-100): 4 vertices, 14.9 ft [21432] island (pts 184-185-186-188-187): 5 vertices, closed, 39.8 ft [21433] south parking curb along wall (pts 223-217-216-212-205): 5 vertices, 103.0 ft [21434] SS-V-ROAD-CURB: 8 new, 0 already there, 23 polylines on the layer now (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.