← Inbox

C3D-BLDG8 · Redraw building with all 8 corners done

Replaces the 6-vertex outline with all 8 BLDG COR points (adds 610 and 664, each ~30ft outside the previous outline). Best non-self-intersecting order, no invented vertices.

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

C# payload

// Redraw the building using ALL 8 BLDG COR points (previous version missed 610 and 664,
// each ~30ft outside the outline). Order 610-620-640-639-645-646-699-664 is the best
// non-self-intersecting ring; turns 106.6/94.0/93.2/94.5/95.2/91.3/89.8/73.8. No invented
// vertices - every vertex is a surveyed point. Closed regular Polyline on the existing layer.
// 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 != 6) continue;   // only my 6-vert version
    var w = (Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id, OpenMode.ForWrite);
    w.Erase();
    erased++;
}
Log($"Erased {erased} prior 6-vertex outline(s).");

var pl = new Polyline();
    pl.AddVertexAt(0, new Point2d(2428060.34, 1064523.02), 0, 0, 0);
    pl.AddVertexAt(1, new Point2d(2428078.37, 1064498.18), 0, 0, 0);
    pl.AddVertexAt(2, new Point2d(2428051.06, 1064462.44), 0, 0, 0);
    pl.AddVertexAt(3, new Point2d(2428053.24, 1064460.52), 0, 0, 0);
    pl.AddVertexAt(4, new Point2d(2428042.45, 1064446.81), 0, 0, 0);
    pl.AddVertexAt(5, new Point2d(2428040.11, 1064448.37), 0, 0, 0);
    pl.AddVertexAt(6, new Point2d(2428029.23, 1064434.88), 0, 0, 0);
    pl.AddVertexAt(7, new Point2d(2428005.91, 1064452.83), 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 (all 8 BLDG COR pts), 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-BLDG8 (0 entities touched).
Entities
Duration
347 ms
Civil 3D
25.0.0.0

Log

Erased 1 prior 6-vertex outline(s).
Drew building: 8 verts (all 8 BLDG COR pts), closed=True, len=234.4.

Notes

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

No notes yet.