C3D-SITE · 358 site elements (house/driveway/setbacks/erosion) done
Proposed site plan shapes in boundary frame
C# payload
// Site plan elements from the photo, placed in the boundary's own (front f / depth d) frame.
// f = along the 60.07' front (0..60), d = into the lot along the 170' side (0=front/road, 170=rear).
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
// find the boundary (closed C-PROP-LINE polyline ~10,212 sf)
Polyline bnd = null;
foreach (ObjectId id in ms) { var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity; if (e is Polyline p && p.Closed && p.Layer == "C-PROP-LINE" && p.NumberOfVertices == 4 && System.Math.Abs(p.Area - 10212) < 800) { bnd = p; break; } }
if (bnd == null) { Log("boundary not found"); return; }
var A = bnd.GetPoint2dAt(0); var B = bnd.GetPoint2dAt(1); var D = bnd.GetPoint2dAt(3);
double fl = A.GetDistanceTo(B), dl = A.GetDistanceTo(D);
var ux = (B.X - A.X) / fl; var uy = (B.Y - A.Y) / fl; // front axis
var vx = (D.X - A.X) / dl; var vy = (D.Y - A.Y) / dl; // depth axis
Point2d P(double f, double d) => new Point2d(A.X + f * ux + d * vx, A.Y + f * uy + d * vy);
void Rect(double f0, double d0, double f1, double d1, string layer, short color) {
EnsureLayer(layer, color);
var pl = new Polyline();
pl.AddVertexAt(0, P(f0, d0), 0, 0, 0); pl.AddVertexAt(1, P(f1, d0), 0, 0, 0);
pl.AddVertexAt(2, P(f1, d1), 0, 0, 0); pl.AddVertexAt(3, P(f0, d1), 0, 0, 0);
pl.Closed = true; pl.Layer = layer; ms.AppendEntity(pl); Tx.AddNewlyCreatedDBObject(pl, true);
}
void Circ(double f, double d, double r, string layer, short color) {
EnsureLayer(layer, color);
var c = new Circle(new Point3d(P(f, d).X, P(f, d).Y, 0), Vector3d.ZAxis, r); c.Layer = layer;
ms.AppendEntity(c); Tx.AddNewlyCreatedDBObject(c, true);
}
Rect(7, 35, 53, 155, "SETBACK", 3); // building setback envelope (7' sides, 35' front, 15' rear)
Rect(12, 48, 46, 125, "BLDG-PROP", 4); // proposed two-storey house
Rect(18, 40, 40, 48, "BLDG-PROP", 4); // porch (front of house)
Rect(2, 2, 10, 62, "DRIVE", 8); // proposed concrete driveway (side)
Rect(4, 6, 56, 160, "SILT-FENCE", 30); // silt fence perimeter
Circ(30, 20, 9.3, "EROSION", 2); // rain garden ~272 sf
Rect(6, 8, 16, 16, "EROSION", 2); // material storage
Rect(6, 18, 15, 26, "EROSION", 2); // temporary dumpster
Rect(0, 0, 12, 8, "EROSION", 2); // gravel construction exit
Log("Site elements drawn (setbacks, house, porch, driveway, silt fence, rain garden, storage, dumpster, gravel exit).");
Result
Log
Site elements drawn (setbacks, house, porch, driveway, silt fence, rain garden, storage, dumpster, gravel exit).
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.