Hi all,
I have an interesting challenge. I am tasked with updating old drawings. The only difficulty that I've run into with the old files are that the TitleBlocks are all done with all of the attributes are named "SPEC". There are 90 attributes. I'm really struggling with getting each attribute's value and then storing the value to a variable so that I can then put that value into a new TitleBlock. The old TB will be deleted to avoid future confusion in the file.
(To clearify, the old TitleBlock is in model space, while there are actually nine new TitleBlocks all in seperate paper space Layouts, and this program may have to run on hundreds of files.)
I only need help with getting the values from the Old TB. I need them in order of first to last or last to first (either way will work since I have the variable names in a list that can be reversed if necessary.)
Can anyone help with a simple function to read through the block's attributes in order and store the attribute's value to a variable name in the seperate list (also in order)?
I've made a few attempt at foreach but I get lost along the way while trying to keep it simple and efficient. (I'm still working on it but some guidance would be greatly appreciated.)
Thank you in advance
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
mid-awe,
perhaps something like
(setq sel (entsel "\nSelect a Block: ")) (setq attlst (mapcar '(lambda (x) (vla-get-TextString x)) (vlax-invoke (vlax-ename->vla-object (car sel)) 'GetAttributes) ) )
hope that helps
Henrique
Thank you. That really does help. I eliminated the need for entsel (user input) with:
ENTINFO (ssname (ssget "x" (list (cons 2 BLOCKNAME))) 0)
But, now I need to get the values stored.
You have got me going in the right direction. Thanks again.
You're welcome, mid-awe
"But, now I need to get the values stored."
the values are stored in "attlst" as a list, you can use its position in the list to fill the new TitleBlocks.
Henrique