Display full version of the post: Weird LISP error - after loading, I get this error

kameron1967
02.02.2011, 17:33
Can anyone tell me why I'm getting this error on just a simple lisp?
Command: KAUnknown command "F".  Press F1 for help.Unknown command "*KEYPLAN|*PATT-*".  Press F1 for help.Unknown command "KA".  Press F1 for help.Unknown command "F".  Press F1 for help.Unknown command "X*|S-GRID*MAT**".  Press F1 for help.Unknown command "KA".  Press F1 for help.Unknown command "T".  Press F1 for help.Unknown command "*KEYPLAN|*PATT-A".  Press F1 for help.Unknown command "KA".  Press F1 for help.Unknown command "T".  Press F1 for help.Unknown command "X*|S-GRID*MAT*-A".  Press F1 for help.Unknown command "KA".  Press F1 for help.Unknown command "T".  Press F1 for help.Unknown command "*KEYPLAN|*PATT-NOTE".  Press F1 for help.Unknown command "KA".  Press F1 for help.
THIS IS THE CODE FOR KA.LSP[CODE](defun c:KA ()  (command "layer" "f" "*keyplan|*patt-*" "") (command "layer" "f" "X*|s-grid*mat**" "") (command "layer" "T" "*keyplan|*patt-A" "") (command "layer" "T" "X*|s-grid*mat*-A" "") (command "layer" "T" "*keyplan|*patt-NOTE" "")(princ)   )[\CODE]

HAWDesigner
02.02.2011, 17:43
I'm not an expert on LISP code (yet), but from what I can tell, your code looks fine.Are you sure the routine is being loaded?

HAWDesigner
02.02.2011, 17:50
I loaded and executed the code you pasted on my system and the only errors I get are "No matching layer names found", which was expected. I suggest verifying that your code is loaded.Good Luck!!

HAWDesigner
02.02.2011, 18:04
Just another thought, but I was looking at your code and noticing that it is calling the layer command 5 times when it could be calling it once. I'm not sure if you have a reason for that, but I do know that it is more efficient to open with the LAYER command, process everything, then close it.Here is a more efficient version of your code (for anyone interested):[code](defun c:KA () (command "layer"            "f" "*keyplan|*patt-*"             "f" "X*|s-grid*mat**"            "T" "*keyplan|*patt-A"            "T" "X*|s-grid*mat*-A"            "T" "*keyplan|*patt-NOTE" "")(princ)  )[/code]

John Connor
02.02.2011, 18:37
You didn't redefine the layer command did you?

kameron1967
02.02.2011, 18:51
When I type in "layer" it pulls up the layer dialogue box.
It's killing me that my lisp routine is not working!!! Sorry, just a little frustrated.  Hopefully someone had the same problem and could help me.

HAWDesigner
02.02.2011, 19:08
just out of curiosity, have you tried using "-LAYER"?

HAWDesigner
02.02.2011, 19:16
Also, have you tried entering each line directly into the command line to see if you get the same error?For instance:[code]Command: (command "layer" "f" "*keyplan|*patt-*" "")[/code]

kameron1967
02.02.2011, 19:16
Thanks - that was from my old days.  I guess I never really noticed it.

kameron1967
02.02.2011, 19:19
[QUOTE=HAWDesigner]Also, have you tried entering each line directly into the command line to see if you get the same error?For instance:[code]Command: (command "layer" "f" "*keyplan|*patt-*" "")[/code][/QUOTE]

 
This is what I got...
 
Command: (command "layer" "f" "*keyplan|*patt-*" "")Unknown command "F".  Press F1 for help.Unknown command "*KEYPLAN|*PATT-*".  Press F1 for help.nil
 
Do you suppose the autocad utility is not being loaded..??  Like acaddoc.lsp, etc..??kameron19672011-02-02 19:20:43

HAWDesigner
02.02.2011, 19:21


[QUOTE=kameron1967] 
This is what I got...
 
Command: (command "layer" "f" "*keyplan|*patt-*" "")Unknown command "F".  Press F1 for help.Unknown command "*KEYPLAN|*PATT-*".  Press F1 for help.nil[/QUOTE]Odd. It's like it's passing right over "layer" and assuming "f" is the command.What version/flavor of AutoCAD are you using?HAWDesigner2011-02-02 19:57:30

Vladimir Michl
02.02.2011, 19:53
Looks like the LAYER command is undefined or redefined. Try:[CODE](command "_-layer" "_f" "*keyplan|*patt-*" "")[/CODE]or[CODE](command ".layer" "_f" "*keyplan|*patt-*" "")[/CODE]

kameron1967
02.02.2011, 21:15
Thanks.  That fixed it.  I'm not sure why it's acting up now though because it's worked in the past before.  Perhaps there is a system variable change that causes me to use this layer command format...?

John Connor
02.02.2011, 22:38
The layer command was undefined after all?  Who would have guessed?  LOL