← Inbox

C3D-LW-ROADSTRIPE · Linework: road striping done

Draws 9 road striping polylines on SS-ROAD-STRIPE, split by type (yellow centre, white edge, turn lane) so different stripe types are never joined.

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

C# payload

// Road striping (yellow / white / turn lane) -> SS-ROAD-STRIPE.
// Split by stripe TYPE first, then chained within each type - yellow centre lines, white edge
// lines and turn-lane markings are separate features and must not be joined to each other.
// Parking stall stripes were handled separately (C3D-LW-PARKSTRIPE) because they are stalls,
// not paths. Regular Polyline (cookbook 11). Host owns Tx; host regens after commit.
const string LAYER = "SS-ROAD-STRIPE";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 2);

    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296346.44, 1280026.66), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296349.93, 1280061.31), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296345.41, 1280062.27), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296344.04, 1280100.62), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296351.94, 1280100.86), 0, 0, 0);
        pl.Elevation = 750.08;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  YELLOW: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296795.59, 1280318.08), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296796.33, 1280326.6), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296808.43, 1280326.63), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296808.74, 1280318.08), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296867.33, 1280318.99), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296867.61, 1280319.02), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296866.77, 1280327.48), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296900.79, 1280328.62), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296901.45, 1280328.56), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296901.12, 1280320.12), 0, 0, 0);
        pl.AddVertexAt(10, new Point2d(2296900.24, 1280320.1), 0, 0, 0);
        pl.Elevation = 731.37;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  YELLOW: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296965.14, 1280324.58), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296971.09, 1280324.97), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296972.36, 1280333.89), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296964.98, 1280333.3), 0, 0, 0);
        pl.Elevation = 727.09;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  YELLOW: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296805.53, 1280294.3), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296805.58, 1280294.25), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296796.34, 1280338.58), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296796.65, 1280363.02), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296808.75, 1280363.03), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296761.39, 1280363.33), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296745.48, 1280364.97), 0, 0, 0);
        pl.Elevation = 733.09;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  WHITE: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296866.79, 1280362.39), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296866.62, 1280337.96), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296867.51, 1280318.1), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296867.5, 1280293.69), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296884.46, 1280293.56), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296897.72, 1280293.38), 0, 0, 0);
        pl.Elevation = 730.39;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  WHITE: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296963.51, 1280292.62), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296966.64, 1280292.53), 0, 0, 0);
        pl.Elevation = 726.09;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  WHITE: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296965.31, 1280360.91), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296975.58, 1280360.69), 0, 0, 0);
        pl.Elevation = 727.46;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  WHITE: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296901.42, 1280361.91), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296900.86, 1280361.9), 0, 0, 0);
        pl.Elevation = 729.99;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  WHITE: " + pl.NumberOfVertices + " verts, " + pl.Length.ToString("F1") + " ft");
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296745.29, 1280363.51), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296808.84, 1280338.57), 0, 0, 0);
        pl.AddVertexAt(2, new Point2d(2296867.63, 1280318.2), 0, 0, 0);
        pl.AddVertexAt(3, new Point2d(2296885.29, 1280318.06), 0, 0, 0);
        pl.AddVertexAt(4, new Point2d(2296901.02, 1280317.91), 0, 0, 0);
        pl.AddVertexAt(5, new Point2d(2296900.83, 1280337.66), 0, 0, 0);
        pl.AddVertexAt(6, new Point2d(2296900.16, 1280337.69), 0, 0, 0);
        pl.AddVertexAt(7, new Point2d(2296965.03, 1280336.19), 0, 0, 0);
        pl.AddVertexAt(8, new Point2d(2296973.91, 1280335.96), 0, 0, 0);
        pl.AddVertexAt(9, new Point2d(2296970.83, 1280317.09), 0, 0, 0);
        pl.AddVertexAt(10, new Point2d(2296966.9, 1280316.75), 0, 0, 0);
        pl.Elevation = 729.57;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
        Log("  TURN: " + 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-STRIPE now holds " + n + " polyline(s) total (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-ROADSTRIPE (0 entities touched).
Entities
Duration
369 ms
Civil 3D
25.0.0.0

Log

  YELLOW: 5 verts, 85.7 ft
  YELLOW: 11 verts, 140.6 ft
  YELLOW: 4 verts, 22.4 ft
  WHITE: 7 verts, 145.3 ft
  WHITE: 6 verts, 98.9 ft
  WHITE: 2 verts, 3.1 ft
  WHITE: 2 verts, 10.3 ft
  WHITE: 2 verts, 0.6 ft
  TURN: 11 verts, 281.1 ft
SS-ROAD-STRIPE now holds 24 polyline(s) total (verified)

Notes

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

No notes yet.