← Inbox

C3D-BLDG10 · Redraw building with all 10 BLDG points done

Replaces the 8-vertex outline with all 10 points containing BLDG (adds 613 and 701, both FC BLDG LINE). Orthogonality error 384.7 vs 615. No invented vertices.

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

C# payload

// Redraw building using ALL 10 points whose description contains BLDG (previous version used
// only the 8 with exactly "BLDG COR", missing 613 and 701 - both "FC BLDG LINE"; 701 is 0.23ft
// from 699, the same corner shot twice under different codes).
// Order 610-613-699-620-640-639-645-646-701-664: best non-self-intersecting ring, err 384.7 (was 615 with 8).
// No invented vertices. 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 != 8) continue;   // only my 8-vert version
    var w = (Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id, OpenMode.ForWrite);
    w.Erase();
    erased++;
}
Log($"Erased {erased} prior 8-vertex outline(s).");

var pl = new Polyline();
    pl.AddVertexAt(0, new Point2d(2428060.34, 1064523.02), 0, 0, 0);
    pl.AddVertexAt(1, new Point2d(2428067.87, 1064517.2), 0, 0, 0);
    pl.AddVertexAt(2, new Point2d(2428029.23, 1064434.88), 0, 0, 0);
    pl.AddVertexAt(3, new Point2d(2428078.37, 1064498.18), 0, 0, 0);
    pl.AddVertexAt(4, new Point2d(2428051.06, 1064462.44), 0, 0, 0);
    pl.AddVertexAt(5, new Point2d(2428053.24, 1064460.52), 0, 0, 0);
    pl.AddVertexAt(6, new Point2d(2428042.45, 1064446.81), 0, 0, 0);
    pl.AddVertexAt(7, new Point2d(2428040.11, 1064448.37), 0, 0, 0);
    pl.AddVertexAt(8, new Point2d(2428029.41, 1064434.73), 0, 0, 0);
    pl.AddVertexAt(9, 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 10 *BLDG* 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-BLDG10 (0 entities touched).
Entities
Duration
612 ms
Civil 3D
25.0.0.0

Log

Erased 1 prior 8-vertex outline(s).
Drew building: 10 verts (all 10 *BLDG* pts), closed=True, len=384.6.

Notes

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

No notes yet.