I need a lisp that will look for blocks "A, B, C, D...etc", and replace them with blocks "1, 2, 3, 4...etc.". So..."A" is replaced by "1", "B" is replaced by "2", and so on. It needs to maintain the blocks rotation, layer, and so on. All of these have attributes, but the attributes between each set is the same..("A"' attribute is identical to "1"'s attribute). I have a solution that works with a single selection by "ENTSEL". But I need an automated solution that replaces all instances of each in the drawing. I tried to call (c:-blockreplace) into the lisp, but i couldn't specify the entry data automatically. Help!
This is what I have so far:
;Replace blocks
;
(defun c:rb (bss / n lst)
(if (tblsearch "block" "ID_KEY2")
(progn
(setq bss (ssget "x" '((2 . "ID_KEY2")(410 . "Model")))))
(if (/= bss nil)
(repeat (setq n (sslength bss))
(setq n (1- n)
lst (cons (ssname bss n) lst)
);end setq
);end repeat
);end if
(foreach n lst (subst(cons 2 "ID_KEY2-E")(assoc 2 n) n))
);end progn
);end if
);end defun