Code:
(DEFUN C:SAL (/ BS BSL CT NOFUV NOFNU LP NE NEL NEAET NEA NEAS OFNU NNEL)
(PROMPT "\n*SET ATTRIBUTE LAYER* ")
(PROMPT "\nSelect blocks with attributes to change layer: ")
(SETQ BS (SSGET '((-4 . "<AND") (0 . "INSERT") (66 . 1) (-4 . "AND>")) ))
(SETQ BSL (SSLENGTH BS))
(SETQ CT (- BSL 1))
(SETQ NOFUV (GETSTRING T "\nNew attribute layer: "))
(SETQ LP 1)
(WHILE LP
(SETQ NE (SSNAME BS CT))
(SETQ CT2 0)
(SETQ LP2 1)
(WHILE LP2
(SETQ NE (ENTNEXT NE))
(SETQ NEL (ENTGET NE))
(SETQ NEAET (CDR (ASSOC 0 NEL)))
(SETQ NEA (ASSOC 8 NEL))
(SETQ NEAS (CDR NEA))
(IF (= NEAET "ATTRIB")
(PROGN
(IF (/= NEA NIL)
(PROGN
(SETQ NOFNU (CONS 8 NOFUV))
(SETQ OFNU NEA)
(SETQ NNEL (SUBST NOFNU OFNU NEL))
(ENTMOD NNEL)
(ENTUPD NE)
));END PROGN/IF NEA
));END PROGN/IF NEAET
(IF (= NEAET "SEQEND") (SETQ LP2 NIL))
);END WHILE LP2
(SETQ CT (- CT 1))
(IF (< CT 0) (SETQ LP NIL))
);END WHILE LP
(PRINC)
);END SAL