← Inbox

C3D-0373 · READ-ONLY: current layer table + entity counts after cleanup [C3D-LAYREAD3] done

Re-runs the layer census after the PDF/HIDDEN/Aec/layer-0 cleanup so we can see what layers and entities remain before repeating the process on the other drawing.

Script file
C3D-0373.cs
Target
260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// READ-ONLY. Full layer table + entity count per layer, plus any PDF underlays and their layers,
// so we can see what "the pdfx layers" are before merging anything.
Log("drawing: " + Db.Filename);

// count entities per layer across model space
var count = new Dictionary<string,int>();
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
foreach (ObjectId id in ms) {
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e == null) continue;
    if (!count.ContainsKey(e.Layer)) count[e.Layer]=0;
    count[e.Layer]++;
}

var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
var names = new List<string>();
foreach (ObjectId id in lt) names.Add(((LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead)).Name);
names.Sort(StringComparer.OrdinalIgnoreCase);

Log("=== LAYERS (" + names.Count + ") ===");
foreach (var n in names) {
    var l = (LayerTableRecord)Tx.GetObject(lt[n], OpenMode.ForRead);
    int c = count.ContainsKey(n) ? count[n] : 0;
    Log(string.Format("  {0,-34} color={1,-10} {2,-4}{3} ents={4}  desc=\"{5}\"",
        l.Name, l.Color.ColorNameForDisplay, l.IsFrozen?"FRZ ":"", l.IsOff?"OFF":"", c, l.Description ?? ""));
}

// PDF underlays
Log("");
Log("=== PDF UNDERLAYS ===");
int pdf=0;
foreach (ObjectId id in ms) {
    var u = Tx.GetObject(id, OpenMode.ForRead) as PdfReference;
    if (u == null) continue;
    pdf++;
    Autodesk.AutoCAD.DatabaseServices.Extents3d ex;
    try { ex = u.GeometricExtents; } catch { ex = new Autodesk.AutoCAD.DatabaseServices.Extents3d(); }
    string defName="";
    try { var def=(PdfDefinition)Tx.GetObject(u.DefinitionId, OpenMode.ForRead); defName=def.SourceFileName; } catch {}
    Log(string.Format("  [{0}] PdfReference on layer {1}  ({2:F1},{3:F1})-({4:F1},{5:F1})  src=\"{6}\"",
        u.Handle, u.Layer, ex.MinPoint.X, ex.MinPoint.Y, ex.MaxPoint.X, ex.MaxPoint.Y, defName));
}
if (pdf==0) Log("  none");

// any layer whose name looks pdf-ish
Log("");
Log("=== layers matching *PDF* ===");
foreach (var n in names) if (n.IndexOf("PDF",StringComparison.OrdinalIgnoreCase)>=0)
    Log("  " + n + "  ents=" + (count.ContainsKey(n)?count[n]:0));

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\ACAD-260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg
Message
Executed C3D-0373 (0 entities touched).
Entities
Duration
350 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\ACAD-260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg
=== LAYERS (41) ===
  0                                  color=white           ents=0  desc=""
  BLOCK_CERT                         color=white           ents=0  desc=""
  BLOCK_CLOSURE                      color=white           ents=0  desc=""
  BLOCK_LEGEND                       color=white           ents=0  desc=""
  BLOCK_NORTH_ARROW                  color=white           ents=0  desc=""
  BLOCK_SCALE                        color=blue            ents=0  desc=""
  BLOCK_TB2                          color=white           ents=0  desc=""
  BOUNDARY                           color=green           ents=0  desc=""
  C-ANNO                             color=white           ents=13  desc=""
  C-PROP-BNDY                        color=150             ents=1  desc=""
  C-PROP-BRNG                        color=92              ents=16  desc=""
  C-PROP-TEXT                        color=92              ents=3  desc=""
  HIDDEN                             color=white      FRZ  ents=291  desc=""
  HORIZONTAL_AND_VERTICAL_CONTROL_POINT color=white           ents=1  desc=""
  PROF-BAND                          color=8               ents=13  desc=""
  PROF-BORDER                        color=white           ents=4  desc=""
  PROF-GRID                          color=253             ents=33  desc=""
  PROF-GRID-MAJ                      color=8               ents=16  desc=""
  PROF-GROUND                        color=green           ents=6  desc=""
  PROF-MH                            color=blue            ents=28  desc=""
  PROF-PIPE                          color=red             ents=14  desc=""
  PROF-TEXT                          color=white           ents=65  desc=""
  PROF-TITLE                         color=white           ents=3  desc=""
  PROPERTY_LINE                      color=white           ents=29  desc=""
  ROAD_CENTER_LINE                   color=red             ents=6  desc=""
  ROAD_EDGE_OF_PAVEMENT              color=8               ents=21  desc=""
  ROAD_RIGHT-OF-WAY                  color=magenta         ents=3  desc=""
  SEWER_EASEMENT                     color=green           ents=1  desc=""
  SEWER_EASEMENT_TEXT                color=green           ents=26  desc=""
  SEWER_LINE                         color=green           ents=6  desc=""
  SEWER_LINE_TEXT                    color=94              ents=13  desc=""
  SEWER_MANHOLE                      color=green           ents=6  desc=""
  SEWER_MANHOLE_EXISTING             color=green           ents=1  desc=""
  SEWER_MANHOLE_TEXT                 color=250             ents=16  desc=""
  V-NODE-BNDY                        color=red             ents=0  desc=""
  V-NODE-BORE                        color=red             ents=0  desc=""
  V-NODE-POLE                        color=red             ents=0  desc=""
  V-NODE-STRM                        color=92              ents=0  desc=""
  V-NODE-TEXT                        color=red             ents=0  desc=""
  V-NODE-TREE                        color=62              ents=0  desc=""
  V-NODE-WATR                        color=blue            ents=0  desc=""

=== PDF UNDERLAYS ===
  none

=== layers matching *PDF* ===

Notes

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

No notes yet.