×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Edit multiple attributes. Different blocks.
2

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!!

Charles S. Parnell
Southern Store Fixtures

RE: Edit multiple attributes. Different blocks.

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) "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.

(OP)
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

RE: Edit multiple attributes. Different blocks.

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.

RE: Edit multiple attributes. Different blocks.

(OP)
Thanks for your help. I still have a lot to learn about LISP.

Thanks again!

Charles S. Parnell
Southern Store Fixtures

RE: Edit multiple attributes. Different blocks.

My old program TranslateAcad used to replace attributes according to a list in Excel.
www.homescript.com

RE: Edit multiple attributes. Different blocks.

dwgBaseDB at http://www.dwgbase.com should help you out. There are step by step instructions in the downloadable example file.

RE: Edit multiple attributes. Different blocks.

2

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.

(OP)
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

RE: Edit multiple attributes. Different blocks.

CParnell,

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.

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources