.NET

Reply
Distinguished Contributor spu
Distinguished Contributor
spu
Posts: 141
Registered: ‎02-21-2007
Message 1 of 4 (304 Views)
Accepted Solution

Current Layer Name

304 Views, 3 Replies
01-03-2013 03:44 AM

Hi,

 

I know acCurDb.Clayer will give the ObjectId of active layer but friends how to get the current layer name.

 

This may be really silly but i had spent lot of time to find and can't get a good solution. Please help....

 

Regards,

Shijith

 

 

If you want to give just current layer name try this code as well

 [CommandMethod("curlayer")]
public void DisplayCurrLayerName()
{
MessageBox.Show(Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("clayer").ToString());
}

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,581
Registered: ‎06-29-2007
Message 2 of 4 (301 Views)

Re: Current Layer Name

01-03-2013 03:59 AM in reply to: spu

Hi,

 

open the object for the ObjectID, that resulting type is a LayerTableRecord, and now you have access tp a property "Name" and that is the layername.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 3 of 4 (294 Views)

Re: Current Layer Name

01-03-2013 04:45 AM in reply to: spu

If you want to give just current layer name try this code as well

        [CommandMethod("curlayer")]
        public void DisplayCurrLayerName()
        {
            MessageBox.Show(Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("clayer").ToString());
        }

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Distinguished Contributor spu
Distinguished Contributor
spu
Posts: 141
Registered: ‎02-21-2007
Message 4 of 4 (255 Views)

Re: Current Layer Name

01-06-2013 12:51 AM in reply to: Hallex

Hi,

 

Both solutions where perfect...

 

Thanks

 

Regards,

Shijith

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.