.NET

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

Get current layer state

298 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,045
Registered: ‎04-27-2009
Message 2 of 6 (275 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: 658
Registered: ‎06-02-2009
Message 3 of 6 (261 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 (241 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 (236 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 (225 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
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!