Edit multiple attributes. Different blocks.
Edit multiple attributes. Different blocks.
(OP)
A2K has a command called Global Attribute. Meaning that it will update similar "TAG names" of block. However it will only update the same TAG names of a block with the same name. (If I have three different size borders in a drawing, all with one of the TAGS of "THE CLIENT" it will only update the TAG "THE CLIENT" for blocks with the same name.
I found a LISP routine on Cadalyst web site called MATTC.LSP (May 2000) that is supposed to update all TAGS with the same name. However it will only edit up to 6 tags. My borders have TEN tags to fill out.
Does anyone have a routine that will globally edit all same name TAGS for "ALL" blocks?
I was able to edit the routine to except up to eight attributes, but since I know very very little about LISP, (I mean very little about LISP), there were problems with it coping the same input information in several locations.
Thanks for any help that any one may offer!!
I found a LISP routine on Cadalyst web site called MATTC.LSP (May 2000) that is supposed to update all TAGS with the same name. However it will only edit up to 6 tags. My borders have TEN tags to fill out.
Does anyone have a routine that will globally edit all same name TAGS for "ALL" blocks?
I was able to edit the routine to except up to eight attributes, but since I know very very little about LISP, (I mean very little about LISP), there were problems with it coping the same input information in several locations.
Thanks for any help that any one may offer!!
Charles S. Parnell
Southern Store Fixtures





RE: Edit multiple attributes. Different blocks.
;------------------------------------------------------------------------------
;CHG_EVERY_ATT
;Tagnames must match exact!
;No error handling!
;------------------------------------------------------------------------------
(defun C:CHG_EVERY_ATT (/ ATTAG ATTBLKSS ATTTXT CDATE CNT MORE NAME TBENT TBNEXT
TXTYPOS)
(setq TAGNAME (getstring "\nWhat is the TagName?")
NEWATT (getstring "\nWhat is the new Attribute?")
)
;Get all inserts with attributes
(setq ATTBLKSS (ssget "X" '((0 . "INSERT")(66 . 1)))
CNT 0
)
(while (< CNT (sslength ATTBLKSS))
(setq TBENT (entnext (ssname ATTBLKSS CNT)))
(setq MORE t
)
(while MORE
(setq TBNEXT (entget TBENT))
(cond ((= (ENTVAL TBNEXT 0) "ATTRIB")
(setq ATTAG (ENTVAL TBNEXT 2)
ATTTXT (ENTVAL TBNEXT 1)
TXTYPOS (cadr (ENTVAL TBNEXT 10))
)
;The
(cond
((= ATTAG TAGNAME) (ATTMOD NEWATT TBNEXT))
) ;cond
(setq TBENT (entnext TBENT))
)
((= (ENTVAL TBNEXT 0) "SEQEND") (setq MORE NIL))
(t (setq TBENT (entnext TBENT)))
) ;cond
) ;while
(setq CNT (1+ CNT))
) ;while
(command "REGENALL")
(princ)
)
;------------------------------------------------------------------------------
; ATTMOD
;------------------------------------------------------------------------------
(defun ATTMOD (ATT E_DAT)
(setq E_DAT (subst (cons 1 ATT) (assoc 1 E_DAT) E_DAT))
(entmod E_DAT)
(princ)
)
;------------------------------------------------------------------------------
; ENTVAL
;------------------------------------------------------------------------------
(defun ENTVAL (E NUM)
(cdr (assoc NUM E))
)
RE: Edit multiple attributes. Different blocks.
Hoping not to sound ungrateful for your routine. Is there a way to make this routine dialog based? It would speed up process not having to reinitiate the routine for each tag.
Thanks again for your HELP!!
Charles S. Parnell
Southern Store Fixtures
RE: Edit multiple attributes. Different blocks.
RE: Edit multiple attributes. Different blocks.
Thanks again!
Charles S. Parnell
Southern Store Fixtures
RE: Edit multiple attributes. Different blocks.
www.homescript.com
RE: Edit multiple attributes. Different blocks.
RE: Edit multiple attributes. Different blocks.
Try this code snippet:
(setq ss (ssget "X" '((0 . "INSERT")(66 . 1)))
num (sslength ss)
i 0
)
(while (< i num
(setq ent (ssname ss i))
(command "_ddatte" ent)
(setq i (1+ i))
) ;while
RE: Edit multiple attributes. Different blocks.
Thanks for your help.
How does your code snippet work?
I tried typing ddatte & _ddatte (that is called out in your code)at the command prompt and it worked just like the AutoCAD command of ddatte. None of my other borders were updated.
All of my borders have the same tag identifers of (P.O.#)and only the one that I selected was updated.
Charles S. Parnell
Southern Store Fixtures
RE: Edit multiple attributes. Different blocks.
The code I posted is for blocks with multiple inserts and
is actually the "ddatte" command with automatic block selection incorporated. The "mattc" program can processed
more than 20 attributes, but it will work for multiple block inserts (same block name) and automatically updates the attributes that have been changed in all the inserts for a particular block. For a common tagname in different
blocks (different blockname), the code posted by borgunit
will do the job.
RE: Edit multiple attributes. Different blocks.
That's a cool lisp routine. I have already found it very useful. It also shows me the need to be more exclusive in what I name my attributes in the future. A lot of people just key in (ex., xxxx or XXXX).
This lisp is nontheless very useful to me. Thanks.