← Inbox

C3D-0430 · V-DWY: two edge polylines down the driveway (no cross-lines) [C3D-DWY4] done

Replaces the earlier V-DWY runs with two polylines - the left and right driveway edges each running the length of the corridor (points ordered along the run, split by side), so no line cuts across the driveway. Left edge clean; right edge has one small kink at the mid bend. Erases prior V-DWY first.

Script file
C3D-0430.cs
Target
281 MARANTHA 2607.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// V-DWY as TWO edge polylines running the length of the driveway (left + right), no lines across.
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 edges=new Point2d[][]{
  new Point2d[]{new Point2d(2359701.8000,1425328.1500),new Point2d(2359706.6000,1425394.9700),new Point2d(2359709.9100,1425446.4300),new Point2d(2359710.2700,1425451.9100),new Point2d(2359711.8300,1425464.7700),new Point2d(2359701.8500,1425609.4500),new Point2d(2359701.9600,1425609.5000),new Point2d(2359704.5100,1425641.4700),new Point2d(2359708.3000,1425641.2000),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(2359684.7800,1425791.4400),new Point2d(2359676.6800,1425793.5600)},
  new Point2d[]{new Point2d(2359717.7200,1425541.0100),new Point2d(2359713.9000,1425609.5800),new Point2d(2359723.0500,1425609.6100),new Point2d(2359723.0800,1425609.6200),new Point2d(2359725.5300,1425639.9300),new Point2d(2359725.4300,1425640.0500),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(2359709.2900,1425726.3000),new Point2d(2359724.7200,1425727.4000),new Point2d(2359720.5500,1425741.6100),new Point2d(2359709.8100,1425771.9200),new Point2d(2359713.7000,1425776.1400)}
}; int drawn=0;
foreach(var e in edges){ var pl=new Polyline(); for(int i=0;i<e.Length;i++) pl.AddVertexAt(i,e[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("  edge [{0}] {1} verts len {2:F1}", back.Handle, back.NumberOfVertices, back.Length)); drawn++; }
Log("drew " + drawn + " driveway edges");
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260711 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\281 MARANTHA 2607.dwg
Message
Executed C3D-0430 (0 entities touched).
Entities
Duration
819 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260711 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\281 MARANTHA 2607.dwg
removed 7 prior V-DWY polylines
  edge [11B81] 17 verts len 495.1
  edge [11B82] 15 verts len 319.4
drew 2 driveway edges

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.