C3D-0703 · 261101 linework: parking stripes [C3D-LW-STRIPE] done
21 polylines on SS-V-ROAD-STRIPE 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-STRIPE";
var lid=EnsureLayer(LAYER,7);
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[]{2232497.6719,1420578.9429,2232498.9983,1420560.0763},new double[]{2232506.9445,1420579.5008,2232508.3202,1420560.6559},new double[]{2232515.2939,1420576.0763,2232515.8783,1420561.3947},new double[]{2232469.4066,1420576.8424,2232470.4514,1420558.2716},new double[]{2232460.0846,1420575.9609,2232461.2906,1420557.2506},new double[]{2232423.8182,1420563.6999,2232442.2000,1420564.7407},new double[]{2232424.2355,1420553.6339,2232442.9856,1420554.5532},new double[]{2232425.5794,1420517.4867,2232443.7412,1420518.6629},new double[]{2232425.7951,1420509.0249,2232444.3793,1420509.8549},new double[]{2232468.3209,1420497.3915,2232467.5028,1420515.4918,2232466.1898,1420535.0756},new double[]{2232477.6158,1420498.2791,2232476.5460,1420516.2383,2232475.3393,1420534.7414},new double[]{2232495.5299,1420499.7411,2232494.1744,1420517.7871,2232493.4492,1420535.8223},new double[]{2232504.5988,1420499.7294,2232503.1440,1420518.1464,2232502.2572,1420537.0232},new double[]{2232438.2607,1420470.9623,2232458.3826,1420473.2415},new double[]{2232439.1773,1420464.4119,2232458.8989,1420466.6559},new double[]{2232357.0395,1420506.9738,2232374.6104,1420507.4358},new double[]{2232357.0977,1420497.9624,2232374.7967,1420498.4671},new double[]{2232353.7605,1420605.2651,2232371.6210,1420606.0094},new double[]{2232354.4440,1420596.6110,2232371.9827,1420597.2083},new double[]{2232359.0412,1420467.5065,2232337.6866,1420466.9000},new double[]{2232358.8010,1420461.3061,2232337.7080,1420460.4940} };
var closed=new bool[]{ false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false };
var notes=new string[]{ "stripe (pts 122-121)","stripe (pts 116-119)","stripe (pts 117-118)","stripe (pts 134-135)","stripe (pts 133-136)","stripe (pts 139-138)","stripe (pts 140-141)","stripe (pts 178-179)","stripe (pts 181-180)","stripe (pts 189-192-194)","stripe (pts 190-191-193)","stripe (pts 195-198-199)","stripe (pts 196-197-200)","stripe (pts 221-220)","stripe (pts 222-219)","stripe (pts 314-312)","stripe (pts 315-313)","stripe (pts 304-302)","stripe (pts 305-303)","stripe (pts 237-239)","stripe (pts 238-240)" };
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
stripe (pts 122-121): 2 vertices, 18.9 ft [21414] stripe (pts 116-119): 2 vertices, 18.9 ft [21415] stripe (pts 117-118): 2 vertices, 14.7 ft [21416] stripe (pts 134-135): 2 vertices, 18.6 ft [21417] stripe (pts 133-136): 2 vertices, 18.7 ft [21418] stripe (pts 139-138): 2 vertices, 18.4 ft [21419] stripe (pts 140-141): 2 vertices, 18.8 ft [2141A] stripe (pts 178-179): 2 vertices, 18.2 ft [2141B] stripe (pts 181-180): 2 vertices, 18.6 ft [2141C] stripe (pts 189-192-194): 3 vertices, 37.7 ft [2141D] stripe (pts 190-191-193): 3 vertices, 36.5 ft [2141E] stripe (pts 195-198-199): 3 vertices, 36.1 ft [2141F] stripe (pts 196-197-200): 3 vertices, 37.4 ft [21420] stripe (pts 221-220): 2 vertices, 20.3 ft [21421] stripe (pts 222-219): 2 vertices, 19.8 ft [21422] stripe (pts 314-312): 2 vertices, 17.6 ft [21423] stripe (pts 315-313): 2 vertices, 17.7 ft [21424] stripe (pts 304-302): 2 vertices, 17.9 ft [21425] stripe (pts 305-303): 2 vertices, 17.5 ft [21426] stripe (pts 237-239): 2 vertices, 21.4 ft [21427] stripe (pts 238-240): 2 vertices, 21.1 ft [21428] SS-V-ROAD-STRIPE: 21 new, 0 already there, 21 polylines on the layer now (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.