← Inbox

C3D-BLDGRECTI · Building footprint with jogs done

Rectilinear footprint keeping all 10 BLDG points as vertices with square corners at the wall jogs. 17 verts, 243.5ft, 2683sf, ratio 22.1.

Script file
C3D-BLDGRECTI.cs
Target
active document · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// Building footprint, RECTILINEAR: all 10 *BLDG* points are vertices, with square corners
// inserted where the wall jogs. Built in the wall frame (rotated 52.2 deg, the dominant wall
// direction), walking the perimeter: points fall on two long walls (the ~3ft offsets at
// 620/640/646 are real jogs, not noise). 17 verts, perimeter 243.5ft, area 2683sf,
// perimeter^2/area = 22.1 (building range 16-25).
// Prior attempts: 10-pt path = 384ft sliver (ratio 82); 4-corner rectangle = clean but
// ignored 6 points. This keeps every surveyed point AND looks like a building.
// Host owns Tx/ModelSpace - no using/Commit here.
int erased = 0;
foreach (ObjectId id in ModelSpace)
{
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e == null || e.Layer != "SS-V-BLDG-OTLN") continue;
    var p = e as Polyline;
    if (p == null || p.NumberOfVertices != 4) continue;
    var w = (Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id, OpenMode.ForWrite);
    w.Erase();
    erased++;
}
Log($"Erased {erased} prior rectangle(s).");

var pl = new Polyline();
    pl.AddVertexAt(0, new Point2d(2428029.41, 1064434.73), 0, 0, 0);
    pl.AddVertexAt(1, new Point2d(2428029.2299999995, 1064434.88), 0, 0, 0);
    pl.AddVertexAt(2, new Point2d(2428039.8502204353, 1064448.5715056858), 0, 0, 0);
    pl.AddVertexAt(3, new Point2d(2428040.11, 1064448.37), 0, 0, 0);
    pl.AddVertexAt(4, new Point2d(2428040.2335379664, 1064448.5292641865), 0, 0, 0);
    pl.AddVertexAt(5, new Point2d(2428042.45, 1064446.81), 0, 0, 0);
    pl.AddVertexAt(6, new Point2d(2428053.142955628, 1064460.595275331), 0, 0, 0);
    pl.AddVertexAt(7, new Point2d(2428053.2400000007, 1064460.52), 0, 0, 0);
    pl.AddVertexAt(8, new Point2d(2428053.3509118124, 1064460.662986646), 0, 0, 0);
    pl.AddVertexAt(9, new Point2d(2428051.0600000005, 1064462.44), 0, 0, 0);
    pl.AddVertexAt(10, new Point2d(2428078.6277206806, 1064497.980091349), 0, 0, 0);
    pl.AddVertexAt(11, new Point2d(2428078.37, 1064498.1800000002), 0, 0, 0);
    pl.AddVertexAt(12, new Point2d(2428083.63684777, 1064504.9699792308), 0, 0, 0);
    pl.AddVertexAt(13, new Point2d(2428067.87, 1064517.1999999997), 0, 0, 0);
    pl.AddVertexAt(14, new Point2d(2428060.34, 1064523.0199999998), 0, 0, 0);
    pl.AddVertexAt(15, new Point2d(2428005.91, 1064452.83), 0, 0, 0);
    pl.AddVertexAt(16, new Point2d(2428005.972216218, 1064452.9102086644), 0, 0, 0);
pl.Closed = true;
pl.Elevation = 419.15;
pl.Layer = "SS-V-BLDG-OTLN";
ModelSpace.AppendEntity(pl);
Tx.AddNewlyCreatedDBObject(pl, true);
Log($"Drew building: {pl.NumberOfVertices} verts, closed={pl.Closed}, len={pl.Length:F1}.");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260709 - 1512 Bass Rd, Macon, GA 31210, USA\260709 - 1512 Bass Rd.dwg
Message
Executed C3D-BLDGRECTI (0 entities touched).
Entities
Duration
348 ms
Civil 3D
25.0.0.0

Log

Erased 2 prior rectangle(s).
Drew building: 17 verts, closed=True, len=243.5.

Notes

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

No notes yet.