.NET

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

Get current layer state

293 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!


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

*Expert Elite*
norman.yuan
Posts: 1,016
Registered: ‎04-27-2009
Message 2 of 6 (270 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: 646
Registered: ‎06-02-2009
Message 3 of 6 (256 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: 785
Registered: ‎02-25-2013
Message 4 of 6 (236 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


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

Active Contributor
varshal_tom
Posts: 39
Registered: ‎01-27-2005
Message 5 of 6 (231 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: 785
Registered: ‎02-25-2013
Message 6 of 6 (220 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


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

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