Hi b_v_mc
First of all, I do not know the name of Your block, neither the name of the attribute,
because of that I presuppose that the block name is "MYBLOCK" and the attribute name is "VALUE", You have to change the code to match Your block name from "MYBLOCK" and the attribute tag from "VALUE".
Code:
(defun c:AttSum ( / ToSum SelSet Items Index BlkName AttName AttDxf )
(initget 3 )
(if (setq ToSum (getint "Enter an integer (example 5 or -5 ) to add or subtract : " ) )
(progn
(while (setq SelSet (ssget '((-4 . "<and" )(0 . "INSERT" )(2 . "MYBLOCK" )(-4 . "and>" ))) )
(setq Items (sslength SelSet ) )
(setq Index -1 )
(repeat Items
(setq Index (1+ Index ) )
(setq BlkName (ssname SelSet Index ) )
(setq AttName (entnext BlkName ) )
(while AttName
(setq AttDxf (entget AttName ) )
(if (=(cdr (assoc 2 AttDxf )) "VALUE" )
(progn
(setq AttDxf (subst (cons 1 (itoa (+ (atoi (cdr (assoc 1 AttDxf ))) ToSum ))) (assoc 1 AttDxf ) AttDxf ) )
(entmod AttDxf )
(entupd BlkName )
)
( )
)
(if (= (cdr (assoc 0 (entget AttName ))) "SEQEND" ) (setq AttName nil ) (setq AttName (entnext AttName )) )
)
)
)
)
( )
)
(princ)
)
: ) Happy Computing !
kennet