Change color of mulitple layers by selecting entities

Change color of mulitple layers by selecting entities

Anonymous
Not applicable
285 Views
1 Reply
Message 1 of 2

Change color of mulitple layers by selecting entities

Anonymous
Not applicable

I have a very old lisp routine (CLC) my office has used for years that doesn't work now that I've upgraded to 2016.  The lisp prompted me to select entities, and then popped open the layer color window, so I could change the color for multiple layers at once.  I'm open to using a similar lisp, especially since I don't know code and can't fix this routine myself.

 

Does anyone know what would be wrong with this lisp?

 

(defun c:clc (/ getlayer en el len txt2 la)
     ; return the layer name of nentsel e
   (defun getlayer (e / en el la len)
      (setq en (car e)
     el (entget en)
     la (get 8 el)
     len (length e)
      )
      (if (> len 2)
  (if (= la "0")
     (setq la (get 8 (entget (car (nth 3 e)))))
  )
  (if (= (get 0 (entget en)) "ATTRIB")
     (progn
        (while
    (/= (get 0 (entget (setq en (entnext en)))) "SEQEND")
        )
        (setq la (get 8 (entget (get -2 (entget en)))))
     )
  )
      )
      (eval la)
   )


   (if (setq e (nentsel "\nPick entity on layer:"))
      (progn
  (setq txt2 (getlayer e))
  (princ (strcat "  Selected layer = " txt2))
  (while (setq e (nentsel "\nPick entity on layer:"))
     (setq la (getlayer e))
     (setq txt2 (strcat txt2 "," la))
     (princ (strcat "  Selected layer = " la))
  )
  (if (setq col (acad_colordlg 3 nil))
     (progn
        (command "LAYER" "c" col txt2 "")
        (princ (strcat "\nLayer(s) "
         txt2
         " have been set to color "
         (itoa col)
         "."
        )
        )
     )
  )
      )
   )
   (princ)
)

 

0 Likes
286 Views
1 Reply
Reply (1)
Message 2 of 2

ВeekeeCZ
Consultant
Consultant
Missing subfunction... (get...)
Add at the end of the code this line:

(defun get (a ed) (cdr (assoc a ed)))

0 Likes