C3D-0704 · 261101 linework: walls [C3D-LW-WALL] done
4 polylines on V-STRC-WALL from the field points (point numbers in the log). Re-running skips any already drawn. Linetype scale 0.5.
C# payload
var LAYER="V-STRC-WALL";
var lid=EnsureLayer(LAYER,1);
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[]{2232337.2173,1420607.0365,2232341.2664,1420610.5464,2232348.8523,1420614.7857,2232355.7178,1420616.4675,2232371.6635,1420617.1768,2232374.6098,1420617.1116},new double[]{2232546.5417,1420523.9971,2232549.1846,1420493.1265,2232549.9654,1420483.5288,2232551.3808,1420482.6061},new double[]{2232344.5291,1420441.0398,2232344.5243,1420446.3274,2232434.2795,1420456.7609,2232461.7176,1420459.8793,2232467.3151,1420460.4875,2232521.6999,1420467.5534,2232537.7233,1420470.4801},new double[]{2232379.6128,1420496.5884,2232415.6137,1420497.9876,2232415.2287,1420507.4854,2232415.7273,1420508.6574} };
var closed=new bool[]{ false,false,false,false };
var notes=new string[]{ "north wall along EP (pts 293-294-295-296-297-298)","east wall (pts 201-202-203-204)","south wall (WALL 2) (pts 247-246-224-215-214-213-211)","brick wall to west bldg corner (pts 231-226-228-230)" };
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
north wall along EP (pts 293-294-295-296-297-298): 6 vertices, 40.0 ft [21429] east wall (pts 201-202-203-204): 4 vertices, 42.3 ft [2142A] south wall (WALL 2) (pts 247-246-224-215-214-213-211): 7 vertices, 200.0 ft [2142B] brick wall to west bldg corner (pts 231-226-228-230): 4 vertices, 46.8 ft [2142C] V-STRC-WALL: 4 new, 0 already there, 4 polylines on the layer now (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.