Search code examples
autocadautolisp

How to read Layer in AutoLisp


How to read layer from poline?

e.g with this i can get (8. "LAYER_NAME") but i wanna see onyl LAYER_NAME because I want to later check by name something

(defun c:test ( / ent enx )
    (if (setq ent (car (entsel)))
        (progn
            (setq enx (entget ent))
            (assoc 8 enx)
        )
    )
)

Solution

  • Change the line

    (assoc 8 enx)
    

    to

    (cdr (assoc 8 enx))