AutoCAD 2010/2011/2012

Reply
Contributor
18 Posts
0 Kudos
Registered: ‎04-27-2012
Post 1 of 18
Accepted Solution

LAYER SHORTCUT

2598 Views, 17 Replies
04-30-2012 01:29 AM

Hi All

 

s it possible to create shortcuts to change between layers rather than using the pull down menu to select the layer required??

 

Any assistance on this or creating custom shortcuts would be greatly appreciated.

 

Thanks

Hi,

 

>> I am using a 2011 Lt verison

Sorry to say now, but for LT all the above tips won't work as LT does not have LISP included. And so also ExpressTools don't exist in LT-version of AutoCAD.

 

At least the ACAD.PGP does exist and can be modified by using a normal texteditor like Notepad.The position of the file depends on your operating system, the easiest way is to search your local disk for a file named ACAD.PGP, it will find one in your user-directory (for release 2011), that can be modified.

IMPORTANT: before making any modifications ==> backup your file!

 

- alfred -

 

*Expert Elite*
9,804 Posts
1,210 Kudos
Registered: ‎06-29-2007
Post 2 of 18

Re: LAYER SHORTCUT

04-30-2012 01:46 AM in reply to: Oliver_C87

Hi,

 

you can use a little bit of LISP to do that. Look at this lines:

(defun C:L1()(command "_-LAYER" "_M" "MyLayer1" ""))

(defun C:L2()(command "_-LAYER" "_M" "MyLayer2" ""))

(defun C:L3()(command "_-LAYER" "_M" "MyLayer3" ""))

(defun C:L4()(command "_-LAYER" "_M" "MyLayer4" ""))

 

If you copy these lines at the end of your ACADDOC.LSP you have 4 additional commands (L1 or L2 or L3 or L4 like the green colored letters) that makes layers (layername = orange part) active, and if they don't exist they are created.

 

So if you start then the command L1 it makes the layer "MyLayer1" active.

 

You can now copy or modify these lines (they are just samples to let you understand what's happening), create your own commands (each line one command) and give each command a layer you like.

 

HTH, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Contributor
18 Posts
0 Kudos
Registered: ‎04-27-2012
Post 3 of 18

Re: LAYER SHORTCUT

04-30-2012 01:54 AM in reply to: Alfred.NESWADBA

Thanks for responding Alfred.

 

Do I have to use 'L1' as the command? or can i simply type 1 (as a number) rather than 'L' all the time?

 

Thanks again.

*Expert Elite*
9,804 Posts
1,210 Kudos
Registered: ‎06-29-2007
Post 4 of 18

Re: LAYER SHORTCUT

04-30-2012 02:00 AM in reply to: Oliver_C87

Hi,

 

>> Do I have to use 'L1' as the command?

If you defined the command to be named "L1" then you  have to type "L1<ENTER>" to start the command.

If you want a command to be named with just one character you can do that, e.g.;

(defun C:1()(command "_-LAYER" "_M" "MyLayer1" ""))

Now you can start it with 1<ENTER>, but be careful with numbers as command names, it's not that it's forbidden, but I have not a good feeling then. (just a feeling, not more).

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Contributor
18 Posts
0 Kudos
Registered: ‎04-27-2012
Post 5 of 18

Re: LAYER SHORTCUT

04-30-2012 02:05 AM in reply to: Alfred.NESWADBA

Excellent!

 

Are you concerned using numbers for commands might cause problems with the program/ script?

 

Also while we are on the topic, can you alter existing shortcut commands for example; co = copy can i modify it to c = copy?

 

Thanks again.

*Expert Elite*
9,804 Posts
1,210 Kudos
Registered: ‎06-29-2007
Post 6 of 18

Re: LAYER SHORTCUT

04-30-2012 02:11 AM in reply to: Oliver_C87

Hi,

 

>> Also while we are on the topic, can you alter existing shortcut commands

>> for example; co = copy can i modify it to c = copy?

That shortcuts are defined in the file ACAD.PGP. If you want them to be modified do that modification in this file (or when you have installed the ExpressTools, then you can use command ALIASEDIT to modify the content of this file).

 

>> Are you concerned using numbers for commands might cause problems with the program/ script?

Yes, anytime and anywhere, and exactly following >>>murphys laws<<< :smileywink:

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Contributor
18 Posts
0 Kudos
Registered: ‎04-27-2012
Post 7 of 18

Re: LAYER SHORTCUT

04-30-2012 02:36 AM in reply to: Alfred.NESWADBA

Sorry Alfred, i'm not familair where the ACAD.PGP. file is located and Im not familiar with Express tools.

 

I am using a 2011 Lt verison. will Express tools work with this?

 

Thanks. You 've been very helpful

Contributor
18 Posts
0 Kudos
Registered: ‎04-27-2012
Post 8 of 18

Re: LAYER SHORTCUT

04-30-2012 02:39 AM in reply to: Oliver_C87

Oh and I also forgot to ask where:

(defun C:L1()(command "_-LAYER" "_M" "MyLayer1" ""))

 

Is located?

 

Thanks

*Expert Elite*
9,804 Posts
1,210 Kudos
Registered: ‎06-29-2007
Post 9 of 18

Re: LAYER SHORTCUT

04-30-2012 02:47 AM in reply to: Oliver_C87

Hi,

 

>> I am using a 2011 Lt verison

Sorry to say now, but for LT all the above tips won't work as LT does not have LISP included. And so also ExpressTools don't exist in LT-version of AutoCAD.

 

At least the ACAD.PGP does exist and can be modified by using a normal texteditor like Notepad.The position of the file depends on your operating system, the easiest way is to search your local disk for a file named ACAD.PGP, it will find one in your user-directory (for release 2011), that can be modified.

IMPORTANT: before making any modifications ==> backup your file!

 

- alfred -

 

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Contributor
18 Posts
0 Kudos
Registered: ‎04-27-2012
Post 10 of 18

Re: LAYER SHORTCUT

04-30-2012 03:17 AM in reply to: Alfred.NESWADBA

Thanks for help Alfred

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post