← Inbox

C3D-LW-CANOPY · Linework: canopy done

4 surveyed points chained nearest-neighbour, breaking the run at a 150ft gap -> 1 polyline(s). Layer SS-ROAD-CANOPY.

Script file
C3D-LW-CANOPY.cs
Target
SS_BLOCK_22X17 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// CANOPY linework -> SS-ROAD-CANOPY
// 4 surveyed points chained nearest-neighbour, breaking the run at a 150ft gap -> 1 polyline(s).
// Regular Polyline only (never Polyline3d - cookbook 11); elevation = mean of each run.
// Host owns Tx; host regens after commit.
const string LAYER = "SS-ROAD-CANOPY";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 52);

    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296600.99, 1280205.63), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296601.38, 1280181.78), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296728.75, 1280181.38), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296728.58, 1280205.25), 0, 0, 0);
        pl.Closed = false;
        pl.Elevation = 728.22;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  run 1: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }

int n = 0;
foreach (ObjectId id in ms) {
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e != null && e.Layer == LAYER && e is Polyline) n++;
}
Log("SS-ROAD-CANOPY now holds " + n + " polyline(s) (verified)");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\SS_BLOCK_22X17.dwg
Message
Executed C3D-LW-CANOPY (0 entities touched).
Entities
Duration
276 ms
Civil 3D
25.0.0.0

Log

  run 1: 4 verts, 175.1 ft
SS-ROAD-CANOPY now holds 1 polyline(s) (verified)

Notes

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

No notes yet.