Jump to content

"Unknown command" echo at comand line


sadhu

Recommended Posts

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 by sadhu
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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. :unsure:

 

BTW did you click on the link the OP posted? :lol:

Link to comment
Share on other sites

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. :unsure:

 

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:

 

lol we've all been there :wink:

Link to comment
Share on other sites

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

 

:unsure:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

:unsure:

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...