Solved! Go to Solution.
Solved by khoa.ho. Go to Solution.
One idea is to create a layer (for Revision purpose), and put all needed entities in this layer. Then use the loop for each entity in the current space, set Entity.Visible = false if this entity (text, line, circle...) is in the "Revision" layer. By that way, users still see this layer on the Layer Manager, but don't see anything in this layer as they are invisible. This layer is also not be able to delete as it is not empty.
Your program will turn on or off entity visibility in the certain layer, using Entity.Visible not layer visible.
myLayer.IsHidden = true;
Thanks for your good note. This is a right article about it: http://adndevblog.typepad.com/autocad/2012/05/creating-a-anonymous-layer.html
To add to FRFR1426 comment when you change value of IsHidden the only thing I could find to get the layermanager to refresh itself was to open the the LayerTable for write.
So any method that changes a IsHidden property I always have had to open the LayerTable for write so it would reflect in LayerManager
The new AutoCAD "Revision" feature (like Microsoft Word) can be implemented as:
layerTableRecord.IsHidden = true; // Hide this layer name from Layer Manager and toolbar
layerTableRecord.IsFrozen = true; // Completely hide all entities in this layer, even Ctrl-A will not select them
layerTableRecord.IsPlottable = false; // Prevent plotting this layer
If you still want to keep an entity with its original layer (especially a block with nested entities in multiple layers) to restore back, use Entity.Visible = false to hide it from the screen. You may think to use Entity.XData to mark the entity is 'Revision" entity to restore back later.
However, if an entity with Entity.Visible = false, it still can be selected by Ctrl-A (select all). You can make them more protected by store it into a Frozen layer, not Off layer.
Once you are done with your test, please mark it as accepted solution to help later readers. I will also give me a try on that. Thanks.