← Inbox

C3D-STRUCT · Connect existing structures (house/deck/steps) + all fence corners done

DRAFT. Traces the EXISTING house (137-pt HC ring, 1445sf), deck, and steps into closed footprints, ring order computed from the point coordinates (angular sort), not the proposed rectangle in the photo. Also connects all 4 FC fence corners in one run as requested (note 169 'OLD FLAGED FC' may be a separate older fence). Layers SS-V-BLDG / -DECK / -STEP / SS-V-FENCE.

Script file
C3D-STRUCT.cs
Target
C:\Users\sanja\OneDrive\_SurveyDisco\260702 - 358 St Johns Ave SW, Atlanta, GA 30315, USA\260702 - 358 St Johns Ave SW.dwg · model space
Author
claude
Approved
yes · reviewer
Timeout
60s

C# payload

// DRAFT: connect existing structure points into closed footprints + connect the 4 FC fence corners.
// Ring order computed from the coordinates (angular sort about each ring's centroid), NOT proximity
// chaining and NOT the proposed-house rectangle in the photo. Points are the source of truth.
var cd = CivilDoc; var cps = cd.CogoPoints;
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

// gather point -> (E,N) by number
var P = new Dictionary<uint, Point2d>();
foreach (ObjectId id in cps) {
    var cp = (Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id, OpenMode.ForRead);
    P[cp.PointNumber] = new Point2d(cp.Easting, cp.Northing);
}

void DrawRing(uint[] order, bool closed, string layer, short color, string label) {
    var verts = new List<Point2d>();
    foreach (var n in order) { if (P.ContainsKey(n)) verts.Add(P[n]); }
    if (verts.Count < 2) { Log($"{label}: <2 pts, skip"); return; }
    EnsureLayer(layer, color);
    var pl = new Polyline();
    for (int i = 0; i < verts.Count; i++) pl.AddVertexAt(i, verts[i], 0, 0, 0);
    pl.Closed = closed; pl.Layer = layer;
    ms.AppendEntity(pl); Tx.AddNewlyCreatedDBObject(pl, true);
    Log($"{label}: {verts.Count} pts on {layer} (closed={closed}).");
}

// existing structures (closed footprints)
DrawRing(new uint[]{138,134,132,131,124,112,113}, true,  "SS-V-BLDG",        7, "HOUSE");
DrawRing(new uint[]{145,144,114,111,110},          true,  "SS-V-BLDG-DECK",   4, "DECK");
DrawRing(new uint[]{100,101,103,102,105,104,109,108,106,107}, true, "SS-V-BLDG-STEP", 6, "STEPS");

// fence corners — connected as asked. 137 is a pin AT a fence corner; 169 reads 'OLD FLAGED FC'
// (likely a separate/older fence) but the user asked to connect all FCs, so one run in number order.
DrawRing(new uint[]{137,167,169,173}, false, "SS-V-FENCE", 3, "FENCE (all FCs)");

Log("Structures + fence drafted from point geometry.");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260702 - 358 St Johns Ave SW, Atlanta, GA 30315, USA\260702 - 358 St Johns Ave SW.dwg
Message
Executed C3D-STRUCT (0 entities touched).
Entities
Duration
582 ms
Civil 3D
25.0.0.0

Log

HOUSE: 7 pts on SS-V-BLDG (closed=True).
DECK: 5 pts on SS-V-BLDG-DECK (closed=True).
STEPS: 10 pts on SS-V-BLDG-STEP (closed=True).
FENCE (all FCs): 4 pts on SS-V-FENCE (closed=False).
Structures + fence drafted from point geometry.

Notes

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

No notes yet.