Jump to content

Recommended Posts

Posted (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 by sadhu
Posted

It works perfectly for me in ACAD versions 2006 and 2010, and with no errors.

 

Steve

Posted
It works perfectly for me in ACAD versions 2006 and 2010, and with no errors.

 

Steve

likewise for 2008
Posted

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?

Posted

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

Posted

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:

Posted

 

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

 

That's recall a very old memories . :stop: :lol:

Posted
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:

Posted

lol we've all been there :wink:

 

Correcto Mundo!!! i remember one of my early posted thread. nobody even bothered to post a reply :lol:

Posted
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:

Posted

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

Posted

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:

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