← Inbox

C3D-260619-LBLAUDIT · Audit all labels and their parents done

Read-only: every Civil 3D label in model space listed by handle with its layer, style and parent object/layer; plus entity counts and state for all PROP and HERO/TRACT layers.

Script file
C3D-260619-LBLAUDIT.cs
Target
260619 · model space
Author
claude
Approved
yes · auto-auth
Timeout
180s

C# payload

// READ-ONLY: full picture of the HERO/TRACT labels and their parents, in handle order so the
// creation sequence is visible, plus what is on the PROP layers.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
bool IsHero(string s) { var u = s.ToUpper(); return u.Contains("HERO") || u.Contains("TRACT"); }

Log("--- every Civil 3D label in model space, by handle ---");
var rows = new List<(long h, string line)>();
foreach (ObjectId id in ms)
{
    var lbl = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Label;
    if (lbl == null) continue;
    string par = "none";
    try {
        var pid = lbl.FeatureId;
        if (!pid.IsNull) {
            var pe = Tx.GetObject(pid, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
            par = pe == null ? "?" : pe.GetType().Name + " h=" + pe.Handle + " on '" + pe.Layer + "'";
        }
    } catch (System.Exception ex) { par = "err:" + ex.Message; }
    string sty = "";
    try { sty = " style='" + lbl.StyleName + "'"; } catch {}
    rows.Add((System.Convert.ToInt64(lbl.Handle.ToString(),16),
        "  h=" + lbl.Handle + "  " + lbl.GetType().Name + "  layer='" + lbl.Layer + "'" + sty + "  PARENT=" + par));
}
rows.Sort((a,b) => a.h.CompareTo(b.h));
foreach (var r in rows) Log(r.line);

Log("--- PROP layers ---");
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
foreach (ObjectId id in lt)
{
    var ltr = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    if (!ltr.Name.ToUpper().Contains("PROP")) continue;
    int cnt = 0;
    foreach (ObjectId eid in ms)
    {
        var e = Tx.GetObject(eid, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
        if (e != null && e.Layer == ltr.Name) cnt++;
    }
    Log("  '" + ltr.Name + "' off=" + ltr.IsOff + " frozen=" + ltr.IsFrozen + " locked=" + ltr.IsLocked +
        " colour=" + ltr.Color.ColorIndex + "  entities=" + cnt);
}

Log("--- HERO/TRACT layers ---");
foreach (ObjectId id in lt)
{
    var ltr = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead);
    if (!IsHero(ltr.Name)) continue;
    int cnt = 0;
    foreach (ObjectId eid in ms)
    {
        var e = Tx.GetObject(eid, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
        if (e != null && e.Layer == ltr.Name) cnt++;
    }
    Log("  '" + ltr.Name + "' off=" + ltr.IsOff + " frozen=" + ltr.IsFrozen + " locked=" + ltr.IsLocked +
        " colour=" + ltr.Color.ColorIndex + "  entities=" + cnt);
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260619 - 3625 Stonewall Tell Rd, Atlanta, GA 30349, USA\260619 - 3625 Stonewall Tell Rd ROTATE.dwg
Message
Executed C3D-260619-LBLAUDIT (0 entities touched).
Entities
Duration
434 ms
Civil 3D
25.0.0.0

Log

--- every Civil 3D label in model space, by handle ---
  h=20BA6  GeneralSegmentLabel  layer='C-ANNO' style='Bearing and Distance'  PARENT=Line h=20BA1 on 'SS-BOUNDARY'
  h=20CFD  ParcelSegmentLabel  layer='SS-HERO TRACT A ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=20CFA on 'C-PROP-LINE'
  h=20CFE  ParcelSegmentLabel  layer='SS-HERO TRACT A ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=20CFA on 'C-PROP-LINE'
  h=20CFF  ParcelSegmentLabel  layer='SS-HERO TRACT A ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=20CFA on 'C-PROP-LINE'
  h=20DF9  GeneralSegmentLabel  layer='SS-0-FRAME' style='Bearing and Distance'  PARENT=Line h=20DF0 on 'SS-0-FRAME'
  h=20DFA  GeneralSegmentLabel  layer='SS-0-FRAME' style='Bearing and Distance'  PARENT=Line h=20DF8 on 'SS-0-FRAME'
  h=20E03  GeneralSegmentLabel  layer='SS-0-FRAME' style='Bearing and Distance'  PARENT=Line h=20E02 on 'SS-0-FRAME'
  h=20FB8  GeneralSegmentLabel  layer='SS-0-FRAME' style='Bearing and Distance'  PARENT=Line h=20F41 on 'SS-BOUNDARY PLAT RED'
  h=20FB9  GeneralSegmentLabel  layer='SS-0-FRAME' style='Bearing and Distance'  PARENT=Line h=20F40 on 'SS-BOUNDARY PLAT RED'
  h=20FBA  GeneralSegmentLabel  layer='SS-0-FRAME' style='Bearing and Distance'  PARENT=Line h=20F3F on 'SS-BOUNDARY PLAT RED'
  h=2103E  ParcelSegmentLabel  layer='SS-HERO TRACT A ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=20CFA on 'C-PROP-LINE'
  h=21078  ParcelSegmentLabel  layer='SS-HERO TRACT B ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=21079  ParcelSegmentLabel  layer='C-PROP-LINE-TEXT' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=2107A  ParcelSegmentLabel  layer='SS-HERO TRACT A ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=2107B  ParcelSegmentLabel  layer='SS-HERO TRACT A ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=2107C  ParcelSegmentLabel  layer='SS-HERO TRACT B ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=2107D  ParcelSegmentLabel  layer='SS-HERO TRACT B ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=2107E  ParcelSegmentLabel  layer='SS-HERO TRACT B ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=2107F  ParcelSegmentLabel  layer='SS-HERO TRACT B ANNO' style='Bearing over Distance'  PARENT=ParcelSegment h=21076 on 'C-PROP-LINE'
  h=2109C  GeneralSegmentLabel  layer='C-ANNO' style='Bearing and Distance'  PARENT=Line h=20BA0 on 'SS-BOUNDARY'
  h=218FE  GeneralSegmentLabel  layer='SS-BOUNDARY PLAT RED' style='Bearing and Distance'  PARENT=Line h=20F98 on 'SS-BOUNDARY PLAT RED'
  h=218FF  GeneralSegmentLabel  layer='SS-BOUNDARY PLAT RED' style='Bearing and Distance'  PARENT=Line h=20FCA on 'SS-BOUNDARY PLAT RED'
  h=21900  GeneralSegmentLabel  layer='SS-BOUNDARY PLAT RED' style='Bearing and Distance'  PARENT=Line h=20F95 on 'SS-BOUNDARY PLAT RED'
  h=21901  GeneralSegmentLabel  layer='SS-BOUNDARY PLAT RED' style='Bearing and Distance'  PARENT=Line h=20FC6 on 'SS-BOUNDARY PLAT RED'
  h=21B85  GeneralSegmentLabel  layer='C-ANNO' style='Bearing and Distance'  PARENT=Polyline h=2190F on 'SS-BOUNDARY TRACT NF'
  h=21B86  GeneralSegmentLabel  layer='C-ANNO' style='Bearing and Distance'  PARENT=Polyline h=2190F on 'SS-BOUNDARY TRACT NF'
  h=21BF4  GeneralSegmentLabel  layer='C-ANNO' style='Bearing and Distance'  PARENT=Line h=21BBC on 'SS-BOUNDARY PROPOSED'
  h=21BF5  GeneralSegmentLabel  layer='C-ANNO' style='Bearing and Distance'  PARENT=Line h=21BF3 on 'SS-BOUNDARY PROPOSED'
  h=22659  NoteLabel  layer='C-ANNO' style='Standard'  PARENT=none
  h=22662  NoteLabel  layer='C-ANNO' style='.16'  PARENT=none
  h=2266C  NoteLabel  layer='C-ANNO' style='.16'  PARENT=none
--- PROP layers ---
  'C-PROP-BRNG' off=False frozen=False locked=False colour=92  entities=0
  'C-PROP-TEXT' off=False frozen=False locked=False colour=92  entities=0
  'C-PROP-LINE' off=False frozen=False locked=False colour=230  entities=3
  'C-PROP-PATT' off=False frozen=False locked=False colour=150  entities=0
  'C-PROP-RSRV' off=False frozen=False locked=False colour=94  entities=0
  'C-PROP-BNDY' off=False frozen=False locked=False colour=150  entities=0
  'C-PROP-LOTS' off=False frozen=False locked=False colour=6  entities=0
  'C-ROAD-PROF-PROP' off=False frozen=False locked=False colour=150  entities=0
  'C-PROP-LINE-TEXT' off=False frozen=False locked=False colour=2  entities=1
  'A-PROP-LINE' off=False frozen=False locked=False colour=7  entities=0
  'C-PROP' off=False frozen=False locked=False colour=7  entities=1
  'SS-PROPOSED-DRIVE' off=False frozen=False locked=False colour=7  entities=0
  'PROPERTY LINES' off=False frozen=False locked=False colour=5  entities=0
  'X-PROP-CRNR' off=False frozen=False locked=False colour=21  entities=0
  'SS-PROPOSED' off=False frozen=False locked=False colour=10  entities=0
  'SS-OUTSITEPROP' off=False frozen=False locked=False colour=210  entities=0
  'C-PROP-PARCEL' off=False frozen=False locked=False colour=4  entities=0
  'SS-BOUNDARY PROPOSED' off=False frozen=False locked=False colour=5  entities=2
--- HERO/TRACT layers ---
  'SS-BOUNDARY TRACT B' off=False frozen=False locked=False colour=5  entities=0
  'SS-HERO TRACT B' off=False frozen=True locked=False colour=5  entities=1
  'SS-HERO TRACT A' off=False frozen=True locked=False colour=5  entities=1
  'SS-HERO TRACT A ANNO' off=False frozen=False locked=False colour=5  entities=6
  'SS-HERO TRACT B ANNO' off=False frozen=False locked=False colour=5  entities=5
  'SS-BOUNDARY TRACT NF' off=False frozen=False locked=False colour=6  entities=1

Notes

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

No notes yet.