← Inbox

C3D-0581 · List non-C- layers with objects done

Read-only: every layer not starting C- that has top-level entities in model or any layout, with counts by type.

Script file
C3D-0581.cs
Target
261001 - 5040 Rolling Rock Dr.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

var bt=(BlockTable)Tx.GetObject(Db.BlockTableId,OpenMode.ForRead);
var map=new SortedDictionary<string,SortedDictionary<string,int>>(StringComparer.OrdinalIgnoreCase);
foreach(ObjectId sid in bt){
  var sp=(BlockTableRecord)Tx.GetObject(sid,OpenMode.ForRead);
  if(!sp.IsLayout) continue;
  foreach(ObjectId id in sp){
    var en=Tx.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if(en==null) continue;
    if(en.Layer.StartsWith("C-",StringComparison.OrdinalIgnoreCase)) continue;
    if(!map.ContainsKey(en.Layer)) map[en.Layer]=new SortedDictionary<string,int>();
    var t=en.GetType().Name; var d=map[en.Layer];
    d[t]=d.ContainsKey(t)?d[t]+1:1;
  }
}
foreach(var kv in map){
  Log(kv.Key.PadRight(36)+" n="+kv.Value.Values.Sum().ToString().PadRight(6)+" ["+string.Join(" ",kv.Value.Select(x=>x.Key+":"+x.Value))+"]");
}
Log("layers="+map.Count);

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261001 - 5040 Rolling Rock Dr, Sugar Hill, GA 30518, USA\261001 - 5040 Rolling Rock Dr.dwg
Message
Executed C3D-0581 (0 entities touched).
Entities
—
Duration
650 ms
Civil 3D
25.0.0.0

Log

0                                    n=132    [Circle:1 CogoPoint:125 Line:3 Viewport:3]
BLOCK_CLOSURE                        n=33     [Arc:1 DBText:8 Line:12 MText:1 Polyline:4 Polyline2d:2 RasterImage:1 Solid:4]
BLOCK_NORTH_ARROW                    n=202    [Arc:4 DBText:2 Line:180 Polyline2d:16]
BLOCK_NOTES_FLOOD                    n=2      [MText:2]
BLOCK_STAMP                          n=140    [Arc:4 Circle:4 DBText:112 Line:16 Polyline:4]
BLOCK_TB2                            n=100    [BlockReference:1 DBText:15 Line:77 MText:6 Viewport:1]
BOUNDARY                             n=1      [Polyline:1]
PTS                                  n=18     [Circle:6 DBPoint:6 DBText:6]
TB1                                  n=12     [Line:12]
TEXT                                 n=1      [MText:1]
V-CTRL-HCPT                          n=1      [BlockReference:1]
V-NODE-STRM                          n=2      [BlockReference:2]
V-NODE-WATR                          n=2      [BlockReference:2]
X-PROP-CRNR                          n=1      [Circle:1]
layers=14

Notes

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

No notes yet.