I saw one a similar request like this way back. written by Peter of this forum called Bump.lsp
http://www.augi.com/forums/showthread.php?t=126841
Originally Posted by
Lee Mac
Do each of your values have the same attribute tag?, i.e. Do "0" and "1" both have attribute tag "Rev"? (similar for Description etc.)
If they do, a program would have to rely on the order of the attributes in the block definition and *hope* it turns out OK..
You're right Lee. a program like this will be block and position/order specific. in which case Tag Name is irrelevant
One thing i dont get is the way you "bump" the Rev box. I would have think it would be like B would take place where A was and C -> B 0->C 1->0 and leave the top one as blank forthe As built info
Code:
(defun c:test (/ TB AttColl cnt)
(setq TB (vlax-ename->vla-object (car (entsel))))
(setq AttColl (vlax-invoke TB 'GetAttributes) cnt 6)
(repeat (- (length AttColl) 7)
(setq TheText (vla-get-textstring (nth (setq cnt (1+ cnt)) AttColl)))
(vla-put-textstring (nth (- cnt 7) AttColl) TheText
))
(repeat 7
(vla-put-textstring (nth cnt AttColl) ""
)(setq cnt (1- cnt))
)
)
In this example. (see attached) I already know that the second line of this revision box starts with attribute number 7 (rev_1)
(actually 6 of the list <index 0>). I can tell the code to start reading and pass it on the (rev_0)
and leave the last one as blank, or we can write it in such away the code will prompt you for the values on the last 7 tags
like this
Code:
(defun c:test2 (/ TB AttColl cnt)
(setq TB (vlax-ename->vla-object (car (entsel))))
(setq AttColl (vlax-invoke TB 'GetAttributes) cnt 6)
(repeat (- (length AttColl) 7)
(setq TheText (vla-get-textstring (nth (setq cnt (1+ cnt)) AttColl)))
(vla-put-textstring (nth (- cnt 7) AttColl) TheText
))
(setq cnt 20)
(foreach prmpt '("Revision Number/Letter: "
"Description: "
"Date: "
"Drawn By: "
"Checked By"
"Approved By [1]: "
"Approved By [2]: ")
(while (eq ""
(setq New (getstring (strcat "\n" prmpt)))))
(vla-put-textstring (nth (setq cnt (1+ cnt)) AttColl) New)
)
)