OK. Try these
(vl-load-com)
(defun LM:vl-getattributevalue ( blk tag )
(setq tag (strcase tag))
(vl-some '(lambda ( att ) (if (= tag (strcase (vla-get-tagstring att))) (vla-get-textstring att))) (vlax-invoke blk 'getattributes))
)
(defun LM:vl-setattributevalue ( blk tag val )
(setq tag (strcase tag))
(vl-some
'(lambda ( att )
(if (= tag (strcase (vla-get-tagstring att)))
(progn (vla-put-textstring att val) val)
)
)
(vlax-invoke blk 'getattributes)
)
)
(defun c:+ATT (/ blk c_val ss i a)
(setq ss (ssget ":L" '((0 . "INSERT")(66 . 1))))
(repeat (setq i (sslength ss))
(setq blk (vlax-ename->vla-object (ssname ss (setq i (1- i))))
c_val (LM:vl-getattributevalue blk "REL")
);end_setq
(initget "i1 i2 i3 i4")
(setq a (cond ((getkword "\n[i1/i2/i3/i4] <i1>:")) ("i1")))
(cond ( (= a "i1") (setq a (strcat c_val ";" a)))
( (= a "i2") (setq a (strcat c_val ";" a)))
( (= a "i3") (setq a (strcat c_val ";" a)))
( (= a "i4") (setq a (strcat c_val ";" a)))
);end_cond
(LM:vl-setattributevalue blk "REL" a)
);end_repeat
;(Read:ATT a)
(princ)
);end_defun
(defun c:+ATT2 (/ blk c_val ss i a)
(initget "i1 i2 i3 i4")
(setq a (cond ((getkword "\n[i1/i2/i3/i4] <i1>:")) ("i1"))
ss (ssget ":L" '((0 . "INSERT")(66 . 1)))
);end_setq
(repeat (setq i (sslength ss))
(setq blk (vlax-ename->vla-object (ssname ss (setq i (1- i))))
c_val (LM:vl-getattributevalue blk "REL")
);end_setq
(LM:vl-setattributevalue blk "REL" (strcat c_val ";" a))
);end_repeat
;(Read:ATT a)
(princ)
);end_defun
I have removed your read:att function and moved the selection set selection into the main program
There are two main programs c:+ATT and c:+ATT2. Both require a selection set of blocks on unlocked layers, and there are NO checks that any of the block has the required attribute.
c:+ATT This creates the selection set and loops through each block asking for a new value for the required attribute.
c:+ATT2 This asks for the value then creates the selection set and sets the required attribute in every block to the same value