Global editing of attribute values
in Other
I know this has been discussed in the past, but it has been a while, and there may be new solutions, and old ones that no longer work.
I have title blocks on several tabs, for which I need to change the revision date to today. They currently have differing values, so I can't use ATTEDIT, since it seem to require that I do a search-and-replace for the attribute text.
Any suggestions that will work with v14?
Thanks,
Joe Dunfee
I have title blocks on several tabs, for which I need to change the revision date to today. They currently have differing values, so I can't use ATTEDIT, since it seem to require that I do a search-and-replace for the attribute text.
Any suggestions that will work with v14?
Thanks,
Joe Dunfee
0
Comments
-
Hi Joe,
try the attached LISP routines. They all make use of a function I wrote called BLKATT.
[code]; To use present BLKATT with:
; - A selection set of BLOCKS with ATTRIBUTES
; - Group to work with
; - The info to substitute
; - The attribute tag name
; - T to force a regen of the changed block
(defun blkatt (sset group sub attname regen / num ent att)
(setq num 0)
(repeat (sslength sset)
(setq ent (ssname sset num))
(while
(/= "SEQEND" (cdr (assoc 0 (entget (setq ent (entnext ent))))))
(setq att (entget ent))
(cond
((= attname (cdr (assoc 2 att)))
(setq att
(subst (cons group sub)
(assoc group att)
att
)
)
(entmod att)
(if regen (entupd ent))
)
)
)
(setq num (1+ num))
)
(prin1)
)[/code]
This function allows you to modify attribute properties, such as the text field. e.g. BLTXTVAL
[code];******************************* BLTXTVAL *************************************
; Allows the user to select and then change the text field of ATTRIBUTES
; inside blocks.
;
; NOTE: to see any changes rember to do a REGEN.
; 12/12/1993
; Jason Bourhill
; Auckland
;*****************************************************************************
;requires blkatt
(if (not BLKATT)(load "blkatt.lsp"))
(defun C:BLTXTVAL ( / sset tag txv)
(princ "\nSelect blocks to change ATTRIBUTE txt width: ")
(setq sset (ssget '((0 . "INSERT")(66 . 1)))) ; Selects only Blocks with Attributes
(if (or (= sset ()) (= sset 0))
(princ "\nNothing selected: ")
(progn (setq tag (strcase (getstring "\nEnter attribute TAG name: "))
txv (getstring "\nEnter new text VALUE: "))
(blkatt sset 1 txv tag nil)
(princ "REGEN to see any changes")
)
)
(prin1)
)[/code]
In your case you could use (ssget "x") to first select the entire drawing database, then run BLTXVAL. When prompted to select type P to select the selection set created by ssget. type in the tag value name, then the text field value. This should update all layouts with the same value at once.
Note I wrote these when Maui was still fishing from his waka, may give unexpected results if you have multiline attribute fields, or have used a FIELD. Then again it may just work :-).
Regards,Jason Bourhill
0 -
Thanks for the reply Jason.
When you say, "In your case you could use (ssget "x") to first select the entire drawing database", I think that you want me to type (ssget "x").
Am I to substitute the name of the block for the "x"?
It has been about 25 years since I did any LISP programming. So I am more than a little rusty, and am having difficulty following the logic in these routines. What is the sequence of prompts that the user follows? I think it may be that the 2nd routine prompts the user to select all the blocks to edit. Then, since I would have used used the (ssget "x") command to have selected all the blocks, I just type "P" at that point. Then the user is prompted to type the name of the tag, and finally they are prompted to type the new text.
Can you explain the line;(princ "\nSelect blocks to change ATTRIBUTE txt width: ")
Why does this prompt refer to text width? Is this a typo?
By the way, with ATTEDIT, I had a problem with any text that had spaces in it. Is that going to be an issue with your routine?
Again, thank you very much for the help.
-Joe Dunfee0
This discussion has been closed.