TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mikd on January 08, 2004, 09:30:08 AM
-
Has anybody ideas how to check does any autocad command or loaded applications use the hotkey?
For example "CO" is used by "COPY" but how to check it without reading acad.pgp?
-
Hey mikd,
Welcome to the forums.
Nope, no ideas (although I do have an idea that it can't be done).
If you're looking for "can CO be called to invoke a command or a loaded app", you could search the acad.pgp and run through the atoms-family searching for C:CO.
Sorry for the vaque answer.
-
check the help under
shortcuts (aliases) for commands, table listing of
-
CO as COPY is just an alias to the actual command. You can set it with the pgp file or you could write lisp routines that shorten the name of many functions. Autocad is programmed to know what to look for. Other than that, I don't understand your question.
-
Thanks all
I have idea that for some my routines user be able to change the shortcut by own and programm should notify if it already used.
-
So you are planning on reading the pgp file?
-
The best way I've found to do what I think you're trying to say is, type the command before writing it. If you don't get "Unknown command "cmd-name". Press F1 for help." then you need to consider a different name.
BTW, where are you hailing from. Your English is difficult to read.
-
or if you have express tools just use alias editor. like daron i'm not sure what you're asking...
-
Sorry for my English,
I am from Kazakhstan
I plan there steps:
- aks user about shortcut
- check it if it doesn't use write tmp.lsp with this shortcut
- and load this file
But if this shotcut use any other routine last one doesn't work...
As a poor solution I can create a list file of shortcut for all loaded routines read the pgp file... I don't like this it may work too slow
-
You could set up a command reactor that reports unknown commands. Only problem is how to stop commands that do exist :D
Running through all items in the atoms-family that starts with C: is pretty fast and so is reading the .pgp file (just remember to close it after reading). I wouldn't worry about speed.
If your users are using A2K4, remember to look up the .pgp belonging to their profiles.
-
Kazakhstan, huh. So your primary language is Russian?
-
For the LISP counterparts you could test the existence of a command by using this syntax...
(= nil lispcommand)
Exmaple ...
(= nil C:CO)
If there is a command C:CO then it will return nil, if it does exist then it will return T and you will know the lisp command exists.
I am not sure about PGP aliases
-
This is what I got when I tried it
Command: (= nil C:C)
T
Command: (= nil C:MOVE)
T
Command: (= nil C:WHATSITALLABOUT)
T
Command: (= nil C:ESA)
nil
pgp
actual command
non-command or lisp
lisp
[/list:u]
-
try this:
at the command prompt, type (atoms-family 1)
this will give you a list of strings of all defined functions, is that what you are asking?
-
oops I was thinking faster than I was typing and forgot a few words...
the fact is....
If the return value is T then the the command name equals NIL and as such does not exist.
If the return value is NIL, then the command does exist because it is already set to a value...
-
Dear Ladies and Gentlemen thank you very much for your support!
- The statement (= nil C:SOMETHING) return T if there is AutoCAD command or aliases
- The nice line (atoms-family 1) return the names of all lisp (and maybe arx) functions with “C:bla-bla” and without it.
All of there a check more carefully and post result.
Great! Thank you very much!
-
Here's one that could be used to locate a shortcut in the pgp file. If found, it returns the shortcut, otherwise nil:
(doesThisShortcutReallyExist? "CO")
"CO"
(doesThisShortcutReallyExist? "COPYCAT")
nil
Oh, you might want to change the function name :)
(defun doesThisShortcutReallyExist? (shortcut / chrlst ln pgp pgpfo pos)
(cond ((setq pgp (findfile "acad.pgp"))
(setq pgpfo (open pgp "r"))
(while (setq ln (read-line pgpfo))
(and (/= (substr ln 1 1) ";")
(setq pos (vl-string-position (ascii ",") ln))
(setq chrlst (cons (substr ln 1 pos) chrlst))
)
)
(close pgpfo)
)
)
(car (member shortcut chrlst))
)
-
And to search in the atoms list:
(doesThisCommandExistAsALoadedApplication? "APO")
"C:APO"
(doesThisCommandExistAsALoadedApplication? "APOOH")
nil
(defun doesThisCommandExistAsALoadedApplication? (cmd)
(car (member (strcat "C:" cmd) (atoms-family 1)))
)
-
Mikd,
Your welcome. If you or your administrator installed AutoCAD with the help sections included, I know that from version 2000 on, there is a "Developers Help" section that has a vast amount of information to help you along on your path to enlightenment in the world of AutoCAD. I know that finding something such as "atoms-family" is a bit of a stretch, but take some time out to peruse this volume as it will enrich your life as well as your soul.
-
If you have Express Tools :
ALIASEDIT at the command line gives a listing of PGP commands.