The UNDEFINE Command

William Forty
William Forty

There are many commands in AutoCAD®, and it is possible to create your own custom command shortcuts through either LISP or using acad.pgp (see my article on how to use acad.pgp).

But what if you wanted to remap an existing built in AutoCAD® command to another command? I for example wanted to map "SS" to the COPY command, but the normal methods such as defining a LISP command or using acad.pgp do not work, because "SS" is a built in command for manipulating selection sets.

The solution is this - you must firstly undefine the built in command using the UNDEFINE command. This removes it from the AutoCAD® built in command list, but for that session only. You are then free to use any mechanism to map the command to something else as you would normally. But this does mean that because it's for the current session only, you'll have to do it each time you start up AutoCAD®, which isn't ideal.

But, as usual, there is a way to achieve what we want. We can simply add the following command to the acad.lsp file, and it will run the UNDEFINE command for the specified command when you first open AutoCAD®:

(command “undefine” “ss”)

The command is then free to be mapped as you see fit, and it is often useful to do this immediately following the UNDEFINE command in LISP.

I hope this helps some of you - it took me quite a while to get to the bottom of the problem when trying to remap "SS", so hopefully I'll have saved some of you some time.

As always if you found this post useful please do subscribe below, and if you have any tips to share, no matter how small you think they are, get in touch.



No comments