C3D-0429 · V-DWY: 7 vetted straight polylines (rendered & checked before posting) [C3D-DWY3] done
Replaces the bad V-DWY chain with 7 separate STRAIGHT polylines - DWY points gap-split and self-crossing-resolved, verified in a rendered plot before posting. Erases prior V-DWY polylines first.
C# payload
// V-DWY redo from the vetted plot: 7 separate STRAIGHT polylines, self-crossings resolved.
const string LAYER="V-DWY"; const short COLOR=4;
Log("drawing: " + Db.Filename);
var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForWrite);
ObjectId layId; if(lt.Has(LAYER)) layId=lt[LAYER]; else { var l=new LayerTableRecord(); l.Name=LAYER; l.Color=Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci,COLOR); layId=lt.Add(l); Tx.AddNewlyCreatedDBObject(l,true); }
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForWrite);
var del=new List<ObjectId>();
foreach (ObjectId id in ms){ var e=Tx.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity; if(e is Polyline && e.Layer.Equals(LAYER,System.StringComparison.OrdinalIgnoreCase)) del.Add(id); }
foreach(var id in del) ((Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id,OpenMode.ForWrite)).Erase();
Log("removed " + del.Count + " prior V-DWY polylines");
var runs=new Point2d[][]{
new Point2d[]{new Point2d(2359709.9100,1425446.4300),new Point2d(2359710.2700,1425451.9100),new Point2d(2359711.8300,1425464.7700)},
new Point2d[]{new Point2d(2359713.9000,1425609.5800),new Point2d(2359723.0500,1425609.6100),new Point2d(2359723.0800,1425609.6200)},
new Point2d[]{new Point2d(2359701.9600,1425609.5000),new Point2d(2359701.8500,1425609.4500),new Point2d(2359704.5100,1425641.4700),new Point2d(2359708.3000,1425641.2000),new Point2d(2359725.4300,1425640.0500),new Point2d(2359725.5300,1425639.9300)},
new Point2d[]{new Point2d(2359729.3100,1425687.4100),new Point2d(2359727.6600,1425707.1300),new Point2d(2359710.3700,1425703.7500),new Point2d(2359708.8600,1425686.1400)},
new Point2d[]{new Point2d(2359709.2900,1425726.3000),new Point2d(2359706.4200,1425737.6100),new Point2d(2359702.0600,1425749.0000),new Point2d(2359698.1700,1425757.1700),new Point2d(2359693.2700,1425766.3300),new Point2d(2359688.9600,1425773.4500),new Point2d(2359699.9100,1425784.7600),new Point2d(2359709.8100,1425771.9200),new Point2d(2359713.7000,1425776.1400)},
new Point2d[]{new Point2d(2359684.7800,1425791.4400),new Point2d(2359676.6800,1425793.5600)},
new Point2d[]{new Point2d(2359720.5500,1425741.6100),new Point2d(2359724.7200,1425727.4000)}
}; int drawn=0;
foreach(var run in runs){ var pl=new Polyline(); for(int i=0;i<run.Length;i++) pl.AddVertexAt(i,run[i],0,0,0); pl.LayerId=layId; ms.AppendEntity(pl); Tx.AddNewlyCreatedDBObject(pl,true); var back=(Polyline)Tx.GetObject(pl.ObjectId,OpenMode.ForRead); Log(string.Format(" poly [{0}] {1} verts len {2:F1}", back.Handle, back.NumberOfVertices, back.Length)); drawn++; }
Log("drew " + drawn + " straight DWY polylines");
Ed.Regen();
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260711 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\281 MARANTHA 2607.dwg removed 1 prior V-DWY polylines poly [11B7A] 3 verts len 18.4 poly [11B7B] 3 verts len 9.2 poly [11B7C] 6 verts len 53.4 poly [11B7D] 4 verts len 55.1 poly [11B7E] 9 verts len 89.3 poly [11B7F] 2 verts len 8.4 poly [11B80] 2 verts len 14.8 drew 7 straight DWY polylines
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.