CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.
Please abide by the
rules of this forum.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
Author |
Topic Search Topic Options
|
kameron1967
Groupie
Joined: 30.Jan.2011
Location: United States
Using: autocad 2018
Status: Offline
Points: 29
|
Topic: Weird LISP error - after loading, I get this error 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]
|
|
HAWDesigner
Senior Member
Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
|
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
|
|
HAWDesigner
Senior Member
Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
|
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
|
|
HAWDesigner
Senior Member
Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
|
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
|
|
John Connor
Senior Member
Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
|
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>>
|
|
kameron1967
Groupie
Joined: 30.Jan.2011
Location: United States
Using: autocad 2018
Status: Offline
Points: 29
|
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.
|
|
HAWDesigner
Senior Member
Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
|
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
|
|
HAWDesigner
Senior Member
Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
|
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
|
|
kameron1967
Groupie
Joined: 30.Jan.2011
Location: United States
Using: autocad 2018
Status: Offline
Points: 29
|
Posted: 02.Feb.2011 at 19:16 |
Thanks - that was from my old days. I guess I never really noticed it.
|
|
kameron1967
Groupie
Joined: 30.Jan.2011
Location: United States
Using: autocad 2018
Status: Offline
Points: 29
|
Posted: 02.Feb.2011 at 19:19 |
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..??
Edited by kameron1967 - 02.Feb.2011 at 19:20
|
|