Can anyone point me in the right direction as to how to obtain the current layer state?
Thanks!
Solved! Go to Solution.
Solved by BlackBox_. Go to Solution.
Lokk into Autodesk.AutoCAD.DatabaseServices.LayerStateManager class.
Norman Yuan
Hi
Here is a short sample:
private void updateLayerLock() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; LayerStateManager layStateMng = db.LayerStateManager; layStateMng.SaveLayerState("ColorLinetype", LayerStateMasks.Color & LayerStateMasks.LineType, ObjectId.Null); layStateMng.RestoreLayerState("ColorLinetype", ObjectId.Null, 1, LayerStateMasks.Color & LayerStateMasks.LineType); layStateMng.DeleteLayerState("ColorLinetype"); ed.Regen(); }
Regards,
Philippe
@Anonymous wrote:Can anyone point me in the right direction as to how to obtain the current layer state?
Thanks!
To answer the specific question being asked, the LayerStateManager Class does not implement a Current Property as you're requesting, however, it (the LayerStateManager Class) does provide a LastRestoredLayerState Property.
Hope this helps - Cheers
"How we think determines what we do, and what we do determines what we get."
You're welcome; I'm happy to help.
Cheers :beer:
P.S. - Don't forget to mark the appropriate post as solution.
"How we think determines what we do, and what we do determines what we get."
Can't find what you're looking for? Ask the community or share your knowledge.