I am new to lisp, so I don't really know how to make this happen.
Say I have a block containing 10 attributes. Each attribute has a starting number, followed by a letter/no. combo. Ex: 100-A-1, 100-A-2, 100-B-1, 100-B-2, etc. The A-1, A-2, B-1, B-2, etc. is the same in every block. Just the starting number changes from block to block. The program I am using now will allow me to change all attributes in a block in one shot, which is great. The problem is that it changes them all to 100-A-1 or whatever. I need to be able to change the starting number without affecting the letter/no. combo's. I tried keeping the (100) as an attribute and separating it from the (-A-1) which is now dtext. This works, but the client has a prog. that he will use to extract the attribute info from the drawing into excel to generate his sales charts, so the letter/no. combo needs to be part of the attribute. I don't want to manually change every attribute in the drawing one by one. This could take hours. Each block could have up to 16 attributes and each drawing could have hundreds of blocks.
Is there a way to append the combo's to the starting number, or change the starting number without affecting the combo's? Any help would be greatly appreciated
Also, is there a way to have the program terminate at the end, rather than having to hit enter twice? Since every block will have a different starting number, I don't need to select multiple blocks.
Thanks in advance.
I have included the program I am currently using which I think I got from this board? Let me know if you need more info.
(setq tag (itoa 100))
(setq val (getstring "\nInput New Value: "))
(if (and tag (/= tag "") val (/= val ""))
(while
(progn
(princ "\nSelect Block Objects...")
(setq ss (ssget (list (cons 0 "INSERT"))))
)
(setq i 0)
(repeat (sslength ss)
(setq oBlock (vlax-ename->vla-object (ssname ss i)))
(if (= (vla-get-HasAttributes oBlock) :vlax-true)
(progn
(setq attributeList
(vlax-safearray->list
(variant-value (vla-GetAttributes oBlock))
)
)
(foreach attrib attributeList
(if (= (vla-get-TagString attrib) tag)
(vla-put-TextString attrib val)
)
)
)
)
(setq i (1+ i))
)
)
)
(princ)
)