← Inbox

C3D-LW-PARKSTRIPE · Linework: parking stall stripes done

Draws 15 parking stall stripes on SS-ROAD-STRIPE, each an 18ft line across the two surveyed rows. The P STRIPE points are stalls, not a path - chaining them gave one meaningless 251ft polyline.

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

C# payload

// Parking stall striping -> SS-ROAD-STRIPE.
// The 32 "P STRIPE" points are NOT a path - they are two parallel rows at N=1280136.5 and
// N=1280154.5, 18ft apart (the stall depth), with points every ~8ft along each row (the stall
// width). Chaining them by proximity produced one meaningless 251ft polyline regardless of the
// gap threshold, because the spacing is uniform.
// Correct reading: each pair of opposite points is ONE STALL STRIPE, drawn across the 18ft.
// Near-duplicate shots of the same point (within 1ft) were merged first.
// 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(2296603.9, 1280136.58), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296603.71, 1280154.41), 0, 0, 0);
        pl.Elevation = 728.20;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296611.68, 1280137.65), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296611.89, 1280154.5), 0, 0, 0);
        pl.Elevation = 728.23;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296619.72, 1280136.67), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296619.46, 1280154.46), 0, 0, 0);
        pl.Elevation = 728.36;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296626.92, 1280136.56), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296627.0, 1280154.67), 0, 0, 0);
        pl.Elevation = 728.34;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296635.49, 1280136.56), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296635.33, 1280154.46), 0, 0, 0);
        pl.Elevation = 728.34;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296643.61, 1280136.61), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296643.78, 1280154.42), 0, 0, 0);
        pl.Elevation = 728.27;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296652.52, 1280136.54), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296652.6, 1280154.25), 0, 0, 0);
        pl.Elevation = 728.09;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296661.95, 1280136.5), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296661.56, 1280154.68), 0, 0, 0);
        pl.Elevation = 728.09;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296670.85, 1280136.59), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296670.47, 1280154.5), 0, 0, 0);
        pl.Elevation = 728.22;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296678.8, 1280136.43), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296678.93, 1280154.4), 0, 0, 0);
        pl.Elevation = 728.33;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296687.22, 1280136.39), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296687.26, 1280154.4), 0, 0, 0);
        pl.Elevation = 728.34;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296695.54, 1280136.34), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296695.25, 1280154.54), 0, 0, 0);
        pl.Elevation = 728.36;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296703.81, 1280136.5), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296704.05, 1280154.43), 0, 0, 0);
        pl.Elevation = 728.33;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296712.03, 1280136.56), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296712.4, 1280154.53), 0, 0, 0);
        pl.Elevation = 728.29;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }
    {
        var pl = new Polyline();
        pl.AddVertexAt(0, new Point2d(2296720.32, 1280136.39), 0, 0, 0);
        pl.AddVertexAt(1, new Point2d(2296720.49, 1280154.53), 0, 0, 0);
        pl.Elevation = 728.29;
        pl.Layer = LAYER;
        ms.AppendEntity(pl);
        Tx.AddNewlyCreatedDBObject(pl, true);
    }

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("drew 15 parking stall stripes; SS-ROAD-STRIPE 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-PARKSTRIPE (0 entities touched).
Entities
Duration
314 ms
Civil 3D
25.0.0.0

Log

drew 15 parking stall stripes; SS-ROAD-STRIPE now holds 15 polyline(s) (verified)

Notes

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

No notes yet.