Jump to content

What is the problem with this lisp and how to correct it?


Elektrik

Recommended Posts

I want a lips to lock the layer A_arc and turn its color to 255 the first time prompted, then unlock it and turn the color to 255 prompted again. The code below change the color, but the layer stays locked each time. Thanks in advance.

 

(defun c:qr (/ lyr)
  (setq lyr (tblsearch "layer" "A_arc"))
  (if (= (cdr (assoc 62 lyr)) 255)
      (progn
        (command "-layer" "c" "252" "A_arc" "")
        (command "-layer" "lock" "off" "A_arc" "") ; Unlock
      )
      (progn
        (command "-layer" "c" "255" "A_arc" "")
        (command "-layer" "lock" "on" "A_arc" "") ; Lock
      )
  )
  (princ)
)

 

Edited by SLW210
Please use Code Tags!!
Link to comment
Share on other sites

Try this out.

It's helpful to type out commands to make sure you have the correct sequence.

 

(defun c:qr (/ lyr)
  (setq lyr (tblsearch "layer" "A_arc"))
  (if (= (cdr (assoc 62 lyr)) 255)
      (progn
        (command "-layer" "c" "252" "A_arc" "")
        (command "-layer" "unlock" "A_arc" "") ; Unlock
      )
      (progn
        (command "-layer" "c" "255" "A_arc" "")
        (command "-layer" "lock" "A_arc" "") ; Lock
      )
  )
  (princ)
)

 

  • Thanks 1
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...