Message 1 of 3
Princ name of layer to command line

Not applicable
10-06-2015
11:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Please can someone help with an assoc & entget puzzle?
I'm having trouble making this lisp print the name of the layer selected printo to the command line.
It's supposed to display Layer 'mylayer' selected & at the end say x Items Deleted On Layer 'Mylayer'
This line is supposed to return the name of the layer:
(assoc 8 (entget ssl))
Code so far:
(defun c:dlayer ( / ssl ss2) (if (and (princ "\nSelect Layer to Delete ") (setq ssl (ssget "_+.:E:S")) (princ (strcat "\n Layer '" (assoc 8 (entget ssl)) "' Selected")) (setq ss2 (ssget (list (assoc 8 (entget (ssname ssl 0))))))) (command "_.erase" ss2 "") ) (if (= ss2 nil) (princ "\n No Items found") (princ (strcat "\n "(itoa (sslength ss2))" Items Deleted On Layer" (assoc 8 (entget ssl)))) ) (princ) )