Print Page | Close Window

Weird LISP error - after loading, I get this error

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=5251
Printed Date: 11.Jun.2026 at 22:44


Topic: Weird LISP error - after loading, I get this error
Posted By: kameron1967
Subject: Weird LISP error - after loading, I get this error
Date Posted: 02.Feb.2011 at 17:33

Can anyone tell me why I'm getting this error on just a simple lisp?

Command: KA
Unknown 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]




Replies:
Posted By: HAWDesigner
Date Posted: 02.Feb.2011 at 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?

-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: HAWDesigner
Date Posted: 02.Feb.2011 at 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!!


-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: HAWDesigner
Date Posted: 02.Feb.2011 at 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):


(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) 
)



-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: John Connor
Date Posted: 02.Feb.2011 at 18:37
You didn't redefine the layer command did you?


-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: kameron1967
Date Posted: 02.Feb.2011 at 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. Cry


Posted By: HAWDesigner
Date Posted: 02.Feb.2011 at 19:08
just out of curiosity, have you tried using "-LAYER"?

-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: HAWDesigner
Date Posted: 02.Feb.2011 at 19:16
Also, have you tried entering each line directly into the command line to see if you get the same error?

For instance:
Command: (command "layer" "f" "*keyplan|*patt-*" "")



-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: kameron1967
Date Posted: 02.Feb.2011 at 19:16

Thanks - that was from my old days.  I guess I never really noticed it.



Posted By: kameron1967
Date Posted: 02.Feb.2011 at 19:19
Originally posted by HAWDesigner HAWDesigner wrote:

Also, have you tried entering each line directly into the command line to see if you get the same error?

For instance:
Command: (command "layer" "f" "*keyplan|*patt-*" "")

 
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..??


Posted By: HAWDesigner
Date Posted: 02.Feb.2011 at 19:21
Originally posted by kameron1967 kameron1967 wrote:

 
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


Odd. It's like it's passing right over "layer" and assuming "f" is the command.

What version/flavor of AutoCAD are you using?


-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: Vladimir Michl
Date Posted: 02.Feb.2011 at 19:53
Looks like the LAYER command is undefined or redefined. Try:

(command "_-layer" "_f" "*keyplan|*patt-*" "")
or
(command ".layer" "_f" "*keyplan|*patt-*" "")


-------------
Vladimir Michl (moderator)
ARKANCE - https://arkance.world" rel="nofollow - https://arkance.world - Autodesk Platinum Partner


Posted By: kameron1967
Date Posted: 02.Feb.2011 at 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...?



Posted By: John Connor
Date Posted: 02.Feb.2011 at 22:38
The layer command was undefined after all?  Who would have guessed?  LOL

-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>




Print Page | Close Window