@muhamed_ragab92 Something like ?
(defun c:Demo (/ pre post i j ss1 dat ent etdata found)
(if (and
(/= (setq pre (getstring "\nPrefix: ")) "")
(/= (setq suf (getstring "\nSuffix: ")) "")
(not (initget (+ 2 4)))
(setq post (getint "\nNumber: "))
)
(progn
(setq j 0)
(while (setq ss1 (ssget '((0 . "insert")(66 . 1))))
(setq i -1)
(repeat (sslength ss1)
(setq i (1+ i))
(setq dat (strcat pre (itoa (+ post j)) suf)
ent (ssname ss1 i) j (1+ j) found nil)
(while (and (setq ent (entnext ent)) (not found))
(setq etdata (entget ent))
(if (and
(eq (cdr (assoc 0 etdata)) "ATTRIB")
(eq (strcase (cdr (assoc 2 etdata))) "TEST")
)
(progn
(entmod (subst (cons 1 dat) (assoc 1 etdata) etdata))
(entupd ent)
(setq found t)
); progn
); if
); inner while
); repeat
); outer while
); progn
); if
(princ)
)
"Accept as Solution" if it has solved the problem.