← Inbox

C3D-SSROAD-LAYERS · Create SS-ROAD-* layers for non-HCWA features done

Creates SS-ROAD-TBC / CL / STRIPE / SIDEWALK / CONCRETE / GUTTER / GUARDRAIL / BUILDING / WALL / DUMPSTER / CANOPY for the surveyed features the HCWA standard does not cover. Idempotent.

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

C# payload

// Create SS-ROAD-* layers for the surveyed features that have NO home in the HCWA standard.
// HCWA Rev 1.6 covers water and sewer only - curb, striping, sidewalk, concrete, gutter,
// guard rail, walls, canopy and buildings are not in its table, so they go on SS-ROAD-* per
// the user ("MAKE SS-ROAD-[FEATURE] LAYERS FOR ALL THE ONES THAT DONT CURRENTLY MATCH UP",
// including buildings).
// EnsureLayer is idempotent - safe to re-run. Host owns Tx; host regens after commit.
var defs = new (string name, short colour, string desc)[] {
    (@"SS-ROAD-TBC", 3, @"Top back of curb"),
    (@"SS-ROAD-CL", 1, @"Road centerline"),
    (@"SS-ROAD-STRIPE", 2, @"Pavement striping - white/yellow/parking/turn lane"),
    (@"SS-ROAD-SIDEWALK", 4, @"Sidewalk, ramps, sidewalk corners"),
    (@"SS-ROAD-CONCRETE", 8, @"Concrete pads, aprons, canopy slabs"),
    (@"SS-ROAD-GUTTER", 30, @"Gutter and curb-cut gutter"),
    (@"SS-ROAD-GUARDRAIL", 40, @"Guard rail"),
    (@"SS-ROAD-BUILDING", 6, @"Building outline"),
    (@"SS-ROAD-WALL", 33, @"Walls - dumpster, TBC wall, retaining"),
    (@"SS-ROAD-DUMPSTER", 33, @"Dumpster enclosure"),
    (@"SS-ROAD-CANOPY", 52, @"Canopy outline")
};

var lt0 = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
var before = new List<string>();
foreach (ObjectId id in lt0) before.Add(((LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead)).Name);

int made = 0, already = 0;
foreach (var d in defs)
{
    bool existed = before.Contains(d.name);
    var id = EnsureLayer(d.name, d.colour);
    var ltr = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForWrite);
    ltr.Description = d.desc;
    if (existed) { already++; Log("  = " + d.name + " already present"); }
    else { made++; Log("  + " + d.name + "  (colour " + d.colour + ")  " + d.desc); }
}

var lt1 = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
int present = 0, total = 0;
foreach (ObjectId id in lt1) total++;
foreach (var d in defs) if (lt1.Has(d.name)) present++;
Log("created " + made + ", already present " + already +
    "; all " + defs.Length + " SS-ROAD layers present: " + (present == defs.Length ? "YES" : "NO") +
    "; drawing now has " + total + " layers (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-SSROAD-LAYERS (0 entities touched).
Entities
Duration
331 ms
Civil 3D
25.0.0.0

Log

  + SS-ROAD-TBC  (colour 3)  Top back of curb
  + SS-ROAD-CL  (colour 1)  Road centerline
  + SS-ROAD-STRIPE  (colour 2)  Pavement striping - white/yellow/parking/turn lane
  + SS-ROAD-SIDEWALK  (colour 4)  Sidewalk, ramps, sidewalk corners
  + SS-ROAD-CONCRETE  (colour 8)  Concrete pads, aprons, canopy slabs
  + SS-ROAD-GUTTER  (colour 30)  Gutter and curb-cut gutter
  + SS-ROAD-GUARDRAIL  (colour 40)  Guard rail
  + SS-ROAD-BUILDING  (colour 6)  Building outline
  + SS-ROAD-WALL  (colour 33)  Walls - dumpster, TBC wall, retaining
  + SS-ROAD-DUMPSTER  (colour 33)  Dumpster enclosure
  + SS-ROAD-CANOPY  (colour 52)  Canopy outline
created 11, already present 0; all 11 SS-ROAD layers present: YES; drawing now has 401 layers (verified)

Notes

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

No notes yet.