Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit multiple attributes. Different blocks. 2

Status
Not open for further replies.

cparnell

Mechanical
Sep 23, 2002
71
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!! Charles S. Parnell
Southern Store Fixtures
 
Replies continue below

Recommended for you

Give this a try...

;------------------------------------------------------------------------------
;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) &quot;ATTRIB&quot;)
(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) &quot;SEQEND&quot;) (setq MORE NIL))
(t (setq TBENT (entnext TBENT)))
) ;cond
) ;while
(setq CNT (1+ CNT))
) ;while
(command &quot;REGENALL&quot;)
(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))
)
 
I appreciate you effort in creating this routine for others and me who may find a need for this routine.

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
 
It is possible to make it dialog based but, the way it is written, it defines a new acad command. This means to repeat it again, hit ENTER or just type in the appname CHG_EVERY_ATT. You can change the name of the routine to C:CATT (whatever you want) in the lsp file and then just type that in also.
 
Thanks for your help. I still have a lot to learn about LISP.

Thanks again! Charles S. Parnell
Southern Store Fixtures
 

Try this code snippet:

(setq ss (ssget &quot;X&quot; '((0 . &quot;INSERT&quot;)(66 . 1)))
num (sslength ss)
i 0
)
(while (< i num
(setq ent (ssname ss i))
(command &quot;_ddatte&quot; ent)
(setq i (1+ i))
) ;while

 
Estassoc:

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
 
CParnell,

The code I posted is for blocks with multiple inserts and
is actually the &quot;ddatte&quot; command with automatic block selection incorporated. The &quot;mattc&quot; 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.
 
borgunit:

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor