C3D-LAYERDIAG · Diagnose layer palette showing 0 layers (read-only) done
Report layer table count and stored layer filters
C# payload
// Read-only: diagnose the Layer Properties Manager showing "0 of 0 layers".
// Reports the layer table count and any layer FILTERS stored in the drawing (stale/corrupt
// filters are the usual cause of the palette showing nothing).
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
int n = 0, off = 0, frozen = 0;
foreach (ObjectId id in lt) {
var l = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead);
n++;
if (l.IsOff) off++;
if (l.IsFrozen) frozen++;
}
Log($"LAYER TABLE: {n} layers (off={off}, frozen={frozen})");
// layer filters live in the LayerFilters collection
try {
var lf = Db.LayerFilters;
Log($"LayerFilters root: '{lf.Root.Name}' nested={lf.Root.NestedFilters.Count}");
void Dump(Autodesk.AutoCAD.LayerManager.LayerFilter f, string indent) {
Log($"{indent}FILTER '{f.Name}' allowDelete={f.AllowDelete} isIdFilter={f.IsIdFilter} expr='{f.FilterExpression}'");
foreach (Autodesk.AutoCAD.LayerManager.LayerFilter c in f.NestedFilters) Dump(c, indent + " ");
}
foreach (Autodesk.AutoCAD.LayerManager.LayerFilter f in lf.Root.NestedFilters) Dump(f, " ");
Log($"current filter: '{(Db.LayerFilters.Root.NestedFilters.Count == 0 ? "(none)" : "see above")}'");
} catch (System.Exception ex) {
Log("LayerFilters read failed: " + ex.Message);
}
Result
Log
LAYER TABLE: 165 layers (off=0, frozen=6) LayerFilters root: 'All' nested=3 FILTER 'All Used Layers' allowDelete=False isIdFilter=False expr='USED == "TRUE"' FILTER 'Unreconciled New Layers' allowDelete=False isIdFilter=False expr='UNRECONCILED == "TRUE"' FILTER 'Viewport Overrides' allowDelete=False isIdFilter=False expr='VPOVERRIDES == "TRUE"' current filter: 'see above'
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.