Dan,
I modified my code for your block. It prompts you for a reference block and then will ask for blocks to be updated until you give it a right click. An example would be if the reference block you select already has a number 10 in it then the next blocks you select would progress by 1 (ie 11, 12, 13, 14, ...).
Hope this helps,
(defun c:inc (/ ref tobj tstr ttag sel)
;
(defun *get_atts* (obj)
(vlax-safearray->list
(vlax-variant-value
(vla-getattributes
(if (eq (type obj) 'ENAME)
(vlax-ename->vla-object obj)
obj
)
)
)
)
)
;
(defun *find* (attlist nlst)
(vl-remove-if-not
'(lambda (x)
(vl-remove-if-not
'(lambda (y)
(eq (vla-get-tagstring x) y)
)
nlst
)
)
attlist
)
)
;
(defun *put* (obj str lst)
(mapcar '(lambda (x)
(vl-catch-all-apply
'vla-put-textstring
(list (rt:remove obj x) str)
)
)
lst
)
)
;
(defun rt:remove (obj str)
(car
(vl-remove-if-not
'(lambda (x)
(eq (vla-get-tagstring x) str)
)
(*get_atts* obj)
)
)
)
;
(if (and (setq ref (car (entsel "\nSelect reference block: ")))
(eq "INSERT" (cdr (assoc 0 (entget ref))))
)
(progn
(setq tobj (car (*find* (*get_atts* ref) '("NUMB")))
tstr (vla-get-textstring tobj)
ttag (vla-get-tagstring tobj)
)
(while tstr
(setvar "ErrNo" 0)
(if
(not
(setq sel (car (entsel "\nSelect attribute to update: ")))
)
(if (/= 52 (getvar "ErrNo"))
(princ "\nNo object selected, please try again: ")
(progn
(princ "\nRight click detected - Terminate program. ")
(setq tstr nil)
)
)
(cond ((not (setq tstr (itoa (1+ (atoi tstr))))))
((eq ttag "NUMB") (*put* sel tstr '("NUMB")))
)
)
)
)
(*error* (princ "\nNothing selected. *INVALID*"))
)
)