
;; 
;; Commande:  ATT_ADD 
;; par GC (Anciennement ADDATT) 
;; Pour ajouter/soustraire une valeur numerique SIMPLE 
;; a un Attribut SIMPLE sur un Bloc SIMPLE 
;; 

(defun c:ATT_ADD (/ att lst tag nam add ss n)
(if (and
(setq att (car (nentsel "\nSelectionnez UN Attribut a modifier: ")))
(setq lst (entget att))
(= (cdr (assoc 0 lst)) "ATTRIB")
(numberp (read (cdr (assoc 1 lst))))
(setq tag (cdr (assoc 2 lst)))
(setq nam (cdr (assoc 2 (entget (cdr (assoc 330 lst))))))
)
(if (and
(setq add (getreal "\nEntrez la valeur a ajouter ou soustraire : "))
(princ "\nSelectionnez les Blocs a modifier ")
(setq ss (ssget (list '(0 . "INSERT") (cons 2 nam))))
(setq n 0)
)
(while (setq blc (ssname ss n))
(setq att (entnext blc)
lst (entget att)
)
(while (= (cdr (assoc 0 lst)) "ATTRIB")
(if (and (= (cdr (assoc 2 lst)) tag)
(numberp (setq val (read (cdr (assoc 1 lst)))))
)
(progn
(entmod (subst (cons 1 (rtos (+ val add)))
(assoc 1 lst)
lst
)
)
(entupd blc)
)
)
(setq att (entnext att)
lst (entget att)
)
)
(setq n (1+ n))
)
)
(princ "\nL Objet selectionne n'est pas un attribut ! ")
)
(princ)
)  

