← Inbox

C3D-AUDIT613 · Audit 260613 vs HCWA standards (read-only) done

Layer inventory + entity types to compare against the HCWA required layer table

Script file
C3D-AUDIT613.cs
Target
active document · model space
Author
claude
Approved
yes · claude (read-only inspection)
Timeout
60s

C# payload

// Read-only audit of the 260613 drawing against the HCWA As-built CAD Standards.
// Reports: every layer with entity counts by type, drawing units/coord system, and the
// point-code inventory relevant to water/sewer features.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);

var byLayer = new Dictionary<string, Dictionary<string,int>>();
int total = 0;
foreach (ObjectId id in ms) {
    var o = Tx.GetObject(id, OpenMode.ForRead);
    var e = o as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e == null) continue;
    total++;
    string lay = e.Layer, t = o.GetType().Name;
    if (!byLayer.ContainsKey(lay)) byLayer[lay] = new Dictionary<string,int>();
    byLayer[lay][t] = byLayer[lay].TryGetValue(t, out var n) ? n+1 : 1;
}
Log("=== MODEL SPACE LAYERS ===");
foreach (var kv in byLayer.OrderBy(k => k.Key)) {
    var parts = new List<string>();
    foreach (var t in kv.Value.OrderByDescending(x => x.Value)) parts.Add($"{t.Key}x{t.Value}");
    Log($"  {kv.Key,-34} {string.Join(", ", parts)}");
}
Log($"model entities: {total}, layers used: {byLayer.Count}");

// all layers defined in the drawing (even empty) — HCWA requires exact layer names
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
int defined = 0; var hcwa = new List<string>();
foreach (ObjectId id in lt) {
    var l = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    defined++;
    var n = l.Name.ToUpperInvariant();
    if (n.Contains("WATER") || n.Contains("SEWER") || n.Contains("HYDRANT") || n.Contains("EASEMENT")
        || n.Contains("PROJECT_BOUND") || n.Contains("ROAD_") || n.Contains("LOT_") || n.Contains("ADDRESS"))
        hcwa.Add(l.Name);
}
Log($"=== LAYERS DEFINED: {defined} ===");
Log("HCWA-looking layers present:");
foreach (var n in hcwa.OrderBy(x => x)) Log("   " + n);

Log($"INSUNITS={Db.Insunits}");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\CSTORE WATER ABS-260612_SHEET.dwg
Message
Executed C3D-AUDIT613 (0 entities touched).
Entities
Duration
341 ms
Civil 3D
25.0.0.0

Log

=== MODEL SPACE LAYERS ===
  0                                  CogoPointx68, ParcelSegmentLabelx15, Parcelx1, ParcelSegmentTablex1
  SS-ESMT-SSE20                      Sitex1, ParcelSegmentx1, MTextx1
  SS-FRZ                             CogoPointx57, Circlex1
  SS-GREASE                          CogoPointx4
  SS-V-ROAD-CURB                     Polylinex6
  V-ESMT-SSE20                       Polylinex3, DBTextx1, Linex1
  V-GREASE                           Circlex4, DBTextx4
  V-SSWR-MHOL                        Circlex8
  V-SSWR-PIPE                        Linex7, Polylinex1
  V-SSWR-TEXT                        DBTextx23
  V-STRM-STRC                        Polylinex9
  V-STRM-TEXT                        CogoPointx11, DBTextx9
  V-WATR-ALIGN                       Polylinex4
  V-WATR-STRC                        Circlex12, Polylinex3
  V-WATR-TEXT                        DBTextx23
model entities: 279, layers used: 15
=== LAYERS DEFINED: 20 ===
HCWA-looking layers present:
INSUNITS=Feet

Notes

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

No notes yet.