cannot undefine a command

cannot undefine a command

andrew.nao
Advocate Advocate
742 Views
13 Replies
Message 1 of 14

cannot undefine a command

andrew.nao
Advocate
Advocate

i have a custom lisp that overwrites the wblock command. i put the keyboard shortcut "W" in the alias command file. (acad.pgp) however when i press "W" the command "wall offset" is executed. when i try to undefine that command it tells me its not a valid command. is there a way to remove the keyboard shortcut for this command so that the "W" key will be redirected to my custom command for what i remember the "W" key was always a wblock shortcut, now i just cant remove or undefine this command

0 Likes
743 Views
13 Replies
Replies (13)
Message 2 of 14

BrianBenton
Collaborator
Collaborator

The wya the acad.pgp file works is that it uses the last entry it reads. That means you can have aliases for the W key in multiple locations in the PGP file but AutoCAD will only use the last one it sees.

 

It's good practice to make your PGP file edits at the very bottom of the file. So put your new shortcut keys at the bottom of the PGP file and that should override any other entires.

 

I'm assuming you don't want to "undefine" the wblock command just the keyboard short cut. I say that becasue there is an UNDEFINE command that will turn off commads in AutOCAD. 

Brian C. Benton

bbenton@cad-a-blog.com
http://CAD-a-Blog.com
twitter.com/bcbenton
www.facebook.com/CADaBlog


0 Likes
Message 3 of 14

sthompson1021
Advisor
Advisor

Couple of thoughts on this.

1. Is your custom LISP routine loaded at startup or do you use appload to load it when you want it.

2. As Brian said, edits to the PGP file should be at the bottom of the list. Did you redifine W to the command name for your LISP?

3. Did you remember to use the REINIT command after you edited the pgp file? 

0 Likes
Message 4 of 14

BrianBenton
Collaborator
Collaborator

@sthompson1021 wrote:

 

3. Did you remember to use the REINIT command after you edited the pgp file? 


I alwyas forget to do this! Great point!

Brian C. Benton

bbenton@cad-a-blog.com
http://CAD-a-Blog.com
twitter.com/bcbenton
www.facebook.com/CADaBlog


0 Likes
Message 5 of 14

andrew.nao
Advocate
Advocate
my lisp file is loaded at startup in the acaddoc file.
i undefined the OOTB wblock and redefined my lisp as wblock.
i didnt know about the pgp file shortcuts to be at the bottom.
it never was an issue in previous versions so i didnt think about it till i just started to notice this
ill try out the suggestions here and report back
0 Likes
Message 6 of 14

pendean
Community Legend
Community Legend
Lisp routines override PGP file settings: always have, still do: ensure your lisp is actually loaded.
0 Likes
Message 7 of 14

ВeekeeCZ
Consultant
Consultant

Guess you can always use lisp definition of your shortcut.

 

(command "undefine" "wblock")

(defun c:wblock () (something...))

(defun c:w () (c:wblock) (princ))

0 Likes
Message 8 of 14

andrew.nao
Advocate
Advocate
i thought the same thing. but in this case. its not.
the "W" shortcut key is calling the command "wall offset"
not "Wblock".
my lisp is loaded. if i use the shortcut keys "WB" then it works simply because i already have undefined the acad wblock command and redefined with my own custom wblock. it never used to be "WB" shortcut keys im trying to get it back to just "W" shortcut key
0 Likes
Message 9 of 14

andrew.nao
Advocate
Advocate
"W" brings up another command not a wblock command
"WB" brings up the wblock command. thats what im trying to accomplish is to get back my "W" shortcut key
0 Likes
Message 10 of 14

andrew.nao
Advocate
Advocate
reinit didnt work and neither did putting the shortcut key at the bottom of the pgp file
0 Likes
Message 11 of 14

sthompson1021
Advisor
Advisor

Just as a test, in your pgp file at the bottom, try having W call up another command like move and see if that works.

0 Likes
Message 12 of 14

BrianBenton
Collaborator
Collaborator

Now that I think about it I don't think the PGP file can be used for custom lisp routines. I may be wrong. What you likely want to do is edit the LISP file and make the W key the way to start the LISP. Just replace the code that starts it with W, or whatever keystroke you want it to be.

Brian C. Benton

bbenton@cad-a-blog.com
http://CAD-a-Blog.com
twitter.com/bcbenton
www.facebook.com/CADaBlog


0 Likes
Message 13 of 14

sthompson1021
Advisor
Advisor

You can have a LISP called up by a shortcut from the pgp file. I have a couple of them. I'm not sure if the OP is editing the wrong pgp file, or not entering the command name correctly or if there is some other problem. That's why I asked him to try edit the W shortcut to something else.

Message 14 of 14

BrianBenton
Collaborator
Collaborator

@sthompson1021 wrote:

You can have a LISP called up by a shortcut from the pgp file. I have a couple of them. I'm not sure if the OP is editing the wrong pgp file, or not entering the command name correctly or if there is some other problem. That's why I asked him to try edit the W shortcut to something else.


Thanks for confirming that you can do that for LISP files.

Brian C. Benton

bbenton@cad-a-blog.com
http://CAD-a-Blog.com
twitter.com/bcbenton
www.facebook.com/CADaBlog


0 Likes