I want to lock my layer from deleting.
I did it as for object:
public class NonErasableLayer : ObjectOverrule
protected override void Dispose(bool value)
public override bool IsApplicable(Autodesk.AutoCAD.Runtime.RXObject overruledSubject)
if (overruledSubject == null)
return (overruledSubject is LayerTableRecord);
public override void Erase(DBObject dbObject, bool erasing)
if (dbObject is LayerTableRecord)
throw new Autodesk.AutoCAD.Runtime.Exception(ErrorStatus.Not
Then I set overrule for Drawable objects:
When I run it I saw my message from Erase method but... layer is deleted.
This method works fine for any objects as Line or Circle, but doen't work for layer.
How I can reject layer deleting?
In link below is a similar thread and was to store the LayerTableRecord's ObjectIDs as Hard Pointers.
Would use the advice to store in Owners ExtensionDictionary
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register