.NET

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

Get current layer state

309 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,064
Registered: ‎04-27-2009
Message 2 of 6 (286 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: 676
Registered: ‎06-02-2009
Message 3 of 6 (272 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 (252 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 (247 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 (236 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
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.