← Inbox

C3D-PTAUDIT · Audit COGO point descriptions (read-only) done

Tally points by description code (TBC etc), blank descriptions, elevation outliers.

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

C# payload

// READ-ONLY: audit all COGO points — tally by description "code" (first token / normalized) so we can
// see the TBC count and spot weird/outlier descriptions at a glance. No raw dump of 1000s of points.
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;
using Autodesk.AutoCAD.DatabaseServices;

var db = Db;
var cdoc = CivilDocument.GetCivilDocument(db);
using (var tr = db.TransactionManager.StartTransaction())
{
    var byDesc = new SortedDictionary<string,int>(StringComparer.OrdinalIgnoreCase);
    var blankDesc = 0;
    int total = 0;
    var elevOutliers = new List<string>();
    var zList = new List<double>();

    foreach (ObjectId id in cdoc.CogoPoints)
    {
        var cp = tr.GetObject(id, OpenMode.ForRead) as CogoPoint;
        if (cp == null) continue;
        total++;
        var raw = (cp.RawDescription ?? "").Trim();
        if (raw.Length == 0) { blankDesc++; }
        else
        {
            byDesc[raw] = byDesc.TryGetValue(raw, out var c) ? c+1 : 1;
        }
        zList.Add(cp.Elevation);
    }

    Log($"TOTAL POINTS: {total}  (blank description: {blankDesc})");
    Log($"DISTINCT DESCRIPTIONS: {byDesc.Count}");
    Log("TOP 40 by count:");
    foreach (var kv in byDesc.OrderByDescending(k => k.Value).Take(40))
        Log($"   {kv.Value,4}  '{kv.Key}'");

    // elevation sanity: flag points way outside the typical range (median +/- big spread)
    zList.Sort();
    double median = zList[zList.Count/2];
    var far = zList.Where(z => Math.Abs(z - median) > 50).ToList();
    Log($"ELEVATION median={median:0.0}  points >50ft from median: {far.Count}");

    tr.Commit();
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260709 - 1512 Bass Rd, Macon, GA 31210, USA\260709 - 1512 Bass Rd.dwg
Message
Executed C3D-PTAUDIT (0 entities touched).
Entities
Duration
1923 ms
Civil 3D
25.0.0.0

Log

TOTAL POINTS: 692  (blank description: 1)
DISTINCT DESCRIPTIONS: 94
TOP 40 by count:
    259  'TBC'
    122  'NG'
     36  'EP'
     24  'BOL'
     21  'CON COR'
     15  'TBC COR'
     13  'TBC END'
     10  'LP'
      9  'CL'
      9  'CON'
      9  'WV'
      6  '4 IN PVC STUB'
      6  'UNDGR  ELECTR BX'
      5  'FC FL'
      5  'IRRIGATION SPRINKLER'
      5  'SSMH'
      5  'SW'
      5  'TBC END CON'
      4  'BLDG COR'
      4  'DICB'
      4  'GRATE COR'
      4  'TBC CROSS WALK'
      4  'UNDGR  ELECTR BX COR'
      4  'VAULT COR'
      3  '2 IN PVC STUB'
      3  '6 IN BACK FLOW VAVLE'
      3  'BC'
      3  'CON LINE'
      3  'DI'
      3  'DRIVE THRU COR'
      3  'FH'
      3  'IRRIGATION VALVE'
      3  'MAGOOS  SIGN'
      2  'BLDG COR CON COR'
      2  'DUMPSTER COR'
      2  'FC BLDG LINE'
      2  'FL'
      2  'GAS VALVE'
      2  'GREASE TRAP'
      2  'HC PARK'
ELEVATION median=415.8  points >50ft from median: 1

Notes

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

No notes yet.