.NET

Reply
Active Contributor
varshal_tom
Posts: 39
Registered: ‎01-27-2005
Message 1 of 6 (271 Views)
Accepted Solution

Get current layer state

271 Views, 5 Replies
09-10-2013 07:45 AM

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

 

Thanks!

*Expert Elite*
norman.yuan
Posts: 985
Registered: ‎04-27-2009
Message 2 of 6 (248 Views)

Re: Get current layer state

09-10-2013 01:59 PM in reply to: varshal_tom

Lokk into Autodesk.AutoCAD.DatabaseServices.LayerStateManager class.

ADN Support Specialist
philippe.leefsma
Posts: 617
Registered: ‎06-02-2009
Message 3 of 6 (234 Views)

Re: Get current layer state

09-11-2013 01:39 AM in reply to: varshal_tom

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

Distinguished Mentor
BlackBox_
Posts: 745
Registered: ‎02-25-2013
Message 4 of 6 (214 Views)

Re: Get current layer state

09-11-2013 07:45 AM 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



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

Active Contributor
varshal_tom
Posts: 39
Registered: ‎01-27-2005
Message 5 of 6 (209 Views)

Re: Get current layer state

09-11-2013 08:30 AM in reply to: varshal_tom

That helps.  Thank you!

Distinguished Mentor
BlackBox_
Posts: 745
Registered: ‎02-25-2013
Message 6 of 6 (198 Views)

Re: Get current layer state

09-11-2013 10:40 AM 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. 

 

 



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.