sadhu Posted September 13, 2011 Share Posted September 13, 2011 (edited) I' using the code below to change layer. It executes perfectly but after it runs I get the echo "Unknown command "L*". Press F1 for help." at command line. This response makes me feel that something didn't go well. How can I remove that message? Or what is wrong with the code below? (DEFUN c:l1() (command "LAYER" "THAW" "D-1" "") (setvar "clayer" "D-1") (princ)) Edited September 14, 2011 by sadhu Quote Link to comment Share on other sites More sharing options...
StevJ Posted September 13, 2011 Share Posted September 13, 2011 It works perfectly for me in ACAD versions 2006 and 2010, and with no errors. Steve Quote Link to comment Share on other sites More sharing options...
sadhu Posted September 13, 2011 Author Share Posted September 13, 2011 (edited) Maybe this is a solution http://www.cadtutor.net/forum/showthread.php?26726-Unknown-command-quot-SYNTAX-quot-.-Press-F1-for-help.....-why correction : - looks like it isn't so any other suggestion/s is welcome Edited September 14, 2011 by sadhu Quote Link to comment Share on other sites More sharing options...
dbroada Posted September 13, 2011 Share Posted September 13, 2011 It works perfectly for me in ACAD versions 2006 and 2010, and with no errors. Steve likewise for 2008 Quote Link to comment Share on other sites More sharing options...
pBe Posted September 13, 2011 Share Posted September 13, 2011 The only time i see an error message like that is when there are no such command, lisp or otherwise Command: l* Unknown command "L*". Press F1 for help. Are you sure you're typing L1? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 13, 2011 Share Posted September 13, 2011 Try: (defun c:l1 ( ) (if (tblsearch "LAYER" "D-1") (progn (command "_.-layer" "_T" "D-1" "") (setvar "clayer" "D-1") ) (command "_.-layer" "_M" "D-1" "") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
pBe Posted September 13, 2011 Share Posted September 13, 2011 I thought of that Lee. but even without the test for Layers I can't seem to duplicate the error message. It makes me wonder if the lisp rouitne is even loaded at all. BTW did you click on the link the OP posted? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 13, 2011 Share Posted September 13, 2011 BTW did you click on the link the OP posted? That's recall a very old memories . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 13, 2011 Share Posted September 13, 2011 I thought of that Lee. but even without the test for Layers I can't seem to duplicate the error message. It makes me wonder if the lisp rouitne is even loaded at all. It seems the OP has another routine loaded with the same syntax, or has perhaps modified this code and not reloaded it; in any case, I thought it best to add some error trapping. BTW did you click on the link the OP posted? lol we've all been there :wink: Quote Link to comment Share on other sites More sharing options...
pBe Posted September 13, 2011 Share Posted September 13, 2011 lol we've all been there :wink: Correcto Mundo!!! i remember one of my early posted thread. nobody even bothered to post a reply Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 13, 2011 Share Posted September 13, 2011 Try: (defun c:l1 ( ) (if (tblsearch "LAYER" "D-1") (progn (command "_.-layer" "_T" "D-1" "") (setvar "clayer" "D-1") ) (command "_.-layer" "_M" "D-1" "") ) (princ) ) Or maybe.... (defun c:l1 ( ) (if (tblsearch "LAYER" "D-1") (command "_.-layer" "_T" "D-1" "_S" "D-1" "") (command "_.-layer" "_M" "D-1" "") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
sadhu Posted September 14, 2011 Author Share Posted September 14, 2011 Thanks Lee Thanks rkmcswain As usual your code works fine. I tried it this way too but I get the same echo : (DEFUN c:l1() (command "_.-layer" "_T" "D-1" "_S" "D-1" "") (princ)) Table search seems to solve the problem - which I didn't include in my code because I'm 100% sure that that layer exists: .. (tblsearch "LAYER" "D-1") .. Thanks Quote Link to comment Share on other sites More sharing options...
sadhu Posted September 14, 2011 Author Share Posted September 14, 2011 This works fine too. Sorry for the above post. (DEFUN c:l1() (command "_.-layer" "_T" "D-1" "_S" "D-1" "") (princ)) So it must be the way Layer is written. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.