← Inbox

C3D-LW-GUTTER · Linework: gutter done

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

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

C# payload

// GUTTER linework -> SS-ROAD-GUTTER
// 9 surveyed points chained nearest-neighbour, breaking the run at a 100ft 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-GUTTER";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 30);

    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296764.8, 1280119.58), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296764.58, 1280119.23), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296759.84, 1280115.91), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296757.24, 1280113.89), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296753.83, 1280110.49), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296749.52, 1280104.34), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296748.73, 1280103.06), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296747.8, 1280099.93), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296747.74, 1280099.76), 0, 0, 0);
        pl.Closed = false;
        pl.Elevation = 727.96;
        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-GUTTER 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-GUTTER (0 entities touched).
Entities
Duration
320 ms
Civil 3D
25.0.0.0

Log

  run 1: 9 verts, 26.8 ft
SS-ROAD-GUTTER now holds 1 polyline(s) (verified)

Notes

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

No notes yet.