.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get current layer state

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
varshal_tom
759 Views, 5 Replies

Get current layer state

Can anyone point me in the right direction as to how to obtain the current layer state?

 

Thanks!

5 REPLIES 5
Message 2 of 6
norman.yuan
in reply to: varshal_tom

Lokk into Autodesk.AutoCAD.DatabaseServices.LayerStateManager class.

Message 3 of 6

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



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 4 of 6
BlackBox_
in reply to: varshal_tom


@varshal_tom 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."

Message 5 of 6
varshal_tom
in reply to: varshal_tom

That helps.  Thank you!

Message 6 of 6
BlackBox_
in reply to: varshal_tom

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.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost