;;;Elise Moss ;;;www.mossdesigns.com ;;;March 2007 ;;;this routine locks all layers except for the selected layer (defun c:lockall () ; first let's get the layer to keep unlocked (prompt "\n Select item on layer to remain unlocked. ") (setq ent (car (entsel))) ; get entity data (setq ent-data (entget ent)) ; get the layer to be unlocked (setq layer-unlocked (cdr (assoc 8 ent-data))) ;;now get the layer names and put them in a list (while (setq llist (tblnext "layer")) (setq lnlist (cons (cdr (assoc 2 llist)) lnlist)) ) ; find out how many layers are in the list (setq count (length lnlist)) ; set the counter (setq item 0) ; start the loop process (while (< item count) (setq layername (nth item lnlist)) ; is the layer to be unlocked? (if (/= layername layer-unlocked) (command "-layer" "LO" layername "") ) ; increment the counter (setq item (1+ item)) ) ;end while ; set the unlocked layer current (setvar "CLAYER" layer-unlocked) (princ) ) (princ "\n Type 'Lockall' to lock all layers except the selected one. " )