Hey found this in an old lisp library and it deals alot with attribs thought the code might be usefull
;|
; Michael Weaver
; Alascad
; 1073 Badger Road
; Fairbanks, Alaska 99705
; Email:mikeweaver_ak@hotmail.com
; Voice and fax (907)488-3577
; (c)1996, 1997, 1998 Michael Weaver
;
; Revision History
; 3/2/92 Added c:repatt function.
; 10/8/92 Added c:ate and c:atm functions
; 5/30/98 Added c:athm function
; 8/3/98 Added c:attpresuf
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;
; (REPATT) REPlace ATTributes globally
; Environment: autocad release 10 or later
; Function: repatt
; Purpose: Repatt will search for all occurrances of a given block
; and search all attributes within those blocks for a
; given attribute value and replace each occurance with a
; new a specified value.
;
; Syntax: (repatt block old new)
; Where the arguments have the following values
; block the name of the block to search
; old the attribute value to be replaced
; new the new attribute value
;
;
; Included functions block to act on old string new string
; c:nodash prompts user - <null>
; c:repatt prompts user prompts user prompts user
; c:atem select a sample attribute, select subject blocks
; specify the new attribute value.
; c:attpresuf add a prefix and/or suffixe to multiple attributes
|;
;;;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
(defun repatt ( ;REPLACE ATTRIBUTES GLOBALLY
block ;name of block to scan
old ;old attribute value to search for
new ;new attribute value
/ ;end of formal argument list
ss1 ;selection set of blocks
indx1 ;index to ss1 for current block
ent ;entity name for current block
elist ;entity list for current block
ent1 ;entity name for current sub-entity
attflag ;attributes follow flag for current block
elist1 ;entity list for current sub-entity
etype1 ;entity type for current sub-entity
current ;attribute value for current attribute
) ;end of local variable list
(setq ss1 (ssget "x" (list (cons 2 block))))
(if ss1
(progn
(setq indx1 -1)
(while (< (setq indx1 (1+ indx1)) (sslength ss1))
;while blocks in selection set
(setq
ent (ssname ss1 indx1)
ent1 ent
elist (entget ent)
attflag (if (assoc 66 elist)
T
nil
) ;_ end of if
) ;_ end of setq
(if attflag
(progn ;block has attributes
(setq
ent1 (entnext ent1)
elist1 (entget ent1)
etype1 (cdr (assoc 0 elist1))
) ;_ end of setq
(while (/= etype1 "SEQEND"

(if (= etype1 "ATTRIB"

(progn
(setq current (cdr (assoc 1 elist1)))
(if (= current old)
(progn
(setq elist1 (subst (cons 1 new)
(assoc 1 elist1)
elist1
) ;_ end of subst
) ;_ end of setq
(entmod elist1)
) ;end progn
) ;end if current = old?
) ;end progn entity is attrib
) ;end if entity type?
(setq
ent1 (entnext ent1)
elist1 (entget ent1)
etype1 (cdr (assoc 0 elist1))
) ;_ end of setq
) ;end while not seqend
(entupd ent)
) ;end progn block has attributes
) ;end if attributes?
) ;end while not end of ss1
) ;end progn blocks exist
) ;end if blocks exist?
) ;end of repatt
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;RELEASE 10 OR LATER
(defun c:nodash () ;DRIVES REPATT WITH - TO <NULL>
(repatt
(cdr
(assoc
2
(entget
(car
(entsel
"\nSelect block to eliminate dash attributes: "
;select block
) ;_ end of entsel
) ;_ end of car
) ;_ end of entget
) ;_ end of assoc
) ;_ end of cdr
"-" ;old string
"" ;new string
) ;_ end of repatt
) ;_ end of defun
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;Release 10 or later
(defun c:repatt ( ;REPLACE ATTRIBS GLOBALLY, INTERACTIVE
/
)
(repatt
(cdr
(assoc
2
(entget
(car
(entsel
"\nSelect block to replace attributes: " ;select block
) ;_ end of entsel
) ;_ end of car
) ;_ end of entget
) ;_ end of assoc
) ;_ end of cdr
(progn
(setq
oldatt (if oldatt
oldatt
""
) ;_ end of if
test (getstring T (strcat "\nOld attribute value<" oldatt ">:"

)
oldatt (if test
test
oldatt
) ;_ end of if
) ;_ end of setq
) ;_ end of progn
(progn
(setq
newatt (if newatt
newatt
""
) ;_ end of if
test (getstring T (strcat "\nNew attribute value<" newatt ">:"

)
newatt (if test
test
newatt
) ;_ end of if
) ;_ end of setq
) ;_ end of progn
) ;end call to repatt
) ;end c:repatt
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;replaces the value of text and attribute entities with a given value
;RELEASE 11 OR LATER
;Mike Weaver (907)344-7263 2/11/92
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
(defun attrep ( ;REPLACES VALUES OF SELECTED ATTRIBS
value ;new value for entity
/ ;end of argument list
ent ;list returned by nentsel
elist ;entity list for current entity
etype ;entity type for current entity
)
(while (setq ent (nentsel "\nSelect attribute: "

)
(setq
elist (entget (car ent))
etype (cdr (assoc 0 elist))
) ;_ end of setq
(cond
((= "TEXT" etype)
(princ "\nEntity selected was text. "

(setq elist (subst (cons 1 value) (assoc 1 elist) elist))
(entmod elist)
) ;end cond TEXT
((= "ATTRIB" etype)
(princ "\nEntity selected was an attribute. "

(setq elist (subst (cons 1 value) (assoc 1 elist) elist))
(entmod elist)
) ;end cond ATTRIB
(T
(princ "\nEntity selected not text or an attribute. "

) ;end cond not valid
) ;end cond etype?
) ;end while
(if elist
(entupd (cdr (assoc -1 elist)))
) ;_ end of if
) ;end attrep
(defun c:null () ;DRIVES ATTREP WITH <NULL>
(attrep ""

(princ)
) ;_ end of defun
;;;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;;;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;;;c:adt takes selected text and/or attribute entities and combines their
;;;values adding a space and applies the result to the first entity
;;;selected.
;;;
;;;c:adtx works similarly to c:adt except all entities after the first are
;;;erased and there is no space added between the entities.
;;;
;;;adt is the engine driven by c:adt and c:adtx. It's syntax is as follows.
;;;(adt spacemode erasemode)
;;;Where the arguments have the following meanings:
;;;spacemode if non-nil a space is added between text values.
;;;erasemode if non-nil subsequent entities are erased.
;;;
;RELEASE 11 OR LATER
(defun c:adt () ;adds text values with a space, doesn't erase anything
(adt T nil)
) ;_ end of defun
(defun c:adtx () ;adds text values without a space, erases subseqent entities
(adt nil T)
) ;_ end of defun
(defun adt ( ;COMBINES TEXT/ATTRIBUTE VALUES
spacemode ;add intermediate space if non-nil
erasemode ;erase all but 1st item if non-nil
/ ;end of formal argument list
valid ;local function
ent1 ;primary entity
ent2 ;secondary entity
elist1 ;entity list for ent1
elist2 ;entity list for ent2
test ;loop control flag
*error* ;internal error handler
undo ;undo control flag
)
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;LCA - COMMENT: *error* defun no longer evaluates as a list.
;;LCA - COMMENT: *error* defun no longer evaluates as a list.
(defun *error* (st)
(if undo
(progn
(setvar "cmdecho" 0)
(command "undo" "e"

(setvar "cmdecho" 1)
(setq undo nil)
) ;_ end of progn
) ;_ end of if
(if ent1
(redraw (car ent1))
) ;_ end of if
(princ st)
(princ)
) ;_ end of defun
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
(defun valid (elist) ;VALIDATES ENTITY TYPES
(if (or
(= (cdr (assoc 0 elist)) "TEXT"

(= (cdr (assoc 0 elist)) "ATTRIB"

) ;end or
T ;return T
nil
) ;end if
) ;end valid
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
(setvar "cmdecho" 0)
(command "undo" "m"

(setq undo T)
(setvar "cmdecho" 1)
(setq ent1 (nentsel "\nSelect primary entity: "

)
(if ent1
(progn
(redraw (car ent1) 3)
(setq
elist1 (entget (car ent1))
) ;_ end of setq
(if (valid elist1)
(progn
(setq test T)
(while test
(setq
ent2 (nentsel (strcat "\n"
(cdr (assoc 1 elist1))
"\nSelect entity to combine: "
) ;_ end of strcat
) ;_ end of nentsel
elist2 (if ent2
(entget (car ent2))
) ;_ end of if
) ;_ end of setq
(if (and elist2 (valid elist2))
(progn
(setq
elist1 (subst
(cons 1
(strcat
(cdr (assoc 1 elist1))
(if spacemode
" "
""
) ;_ end of if
(cdr (assoc 1 elist2))
) ;end strcat
) ;end cons
(assoc 1 elist1)
elist1
) ;end subst
) ;end setq
(if erasemode
(progn
(entdel (car ent2))
) ;end progn
nil
) ;end if
(entmod elist1)
(redraw (car ent1) 3)
) ;end progn
(if ent2
(princ "\nInvalid entity: "

(setq test nil)
) ;_ end of if
) ;end if elist2 is valid
) ;end while test
(redraw (car ent1)) ;redraw the new entity
) ;end progn valid elist1
(princ "\nInvalid entity: "

) ;end if valid elist1?
) ;end progn entity selected
) ;end if entity selected?
(setvar "cmdecho" 0)
(command "undo" "e"

(setq undo nil)
(setvar "cmdecho" 1)
(princ)
) ;end c:adt
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;;RELEASE 11 OR LATER
(defun c:att (
;;;STUFF TEXT VALUES INTO ATTRIBUTES
/ ;no formal arguments
ent1 ;entity name of first item
elist1 ;entity list of first item
etype1 ;entity type of first item
ent2 ;entity name of second item
elist2 ;entity list of second item
etype2 ;entity type of second item
)
(setq
ent1 (car (nentsel "\nSelect attribute or text to change: "

)
elist1 (entget ent1)
etype1 (cdr (assoc 0 elist1))
) ;_ end of setq
(if (or (= "ATTRIB" etype1) (= "TEXT" etype1))
(progn
(setq
ent2 (car (nentsel "\nSelect value to use: "

)
elist2 (entget ent2)
etype2 (cdr (assoc 0 elist2))
) ;_ end of setq
(if (or (= "ATTRIB" etype2) (= "TEXT" etype2))
(progn
(setq elist1 (subst (assoc 1 elist2) (assoc 1 elist1) elist1))
(entmod elist1)
(entupd ent1)
) ;_ end of progn
(princ "\nSecond entity was not text or attribute "

) ;end if
) ;end if etype1 was an attrib
(princ "\nEntity was not an attribute "

) ;end if etype1 was an attrib?
(princ)
) ;end c:att
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;;RELEASE 11 OR LATER
(defun c:swap ( ;SWAP TEXT OR ATTRIBUTE VALUES
/ ;no formal arguments
ent1 ;entity name of first item
elist1 ;entity list of first item
etype1 ;entity type of first item
val1 ;assoc 1 value of first item
ent2 ;entity name of second item
elist2 ;entity list of second item
etype2 ;entity type of second item
val2 ;assoc 1 value of second item
)
(setq
ent1 (car (nentsel "\nSelect first attribute or text: "

)
elist1 (entget ent1)
etype1 (cdr (assoc 0 elist1))
) ;_ end of setq
(if (or (= "ATTRIB" etype1) (= "TEXT" etype1))
(progn
(setq
ent2 (car (nentsel "\nSelect second attribute or text: "

)
elist2 (entget ent2)
etype2 (cdr (assoc 0 elist2))
) ;_ end of setq
(if (or (= "ATTRIB" etype2) (= "TEXT" etype2))
(progn
(setq
val1 (assoc 1 elist1)
val2 (assoc 1 elist2)
elist1 (subst val2 val1 elist1)
elist2 (subst val1 val2 elist2)
) ;_ end of setq
(entmod elist1)
(entupd ent1)
(entmod elist2)
(entupd ent2)
) ;_ end of progn
(princ "\nSecond entity was not text or attribute "

) ;end if
) ;end if etype1 was an attrib
(princ "\nEntity was not text or attribute "

) ;end if etype1 was an attrib?
(princ)
) ;end c:swap
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
(defun c:res ( ;REMOVES LEADING AND TRAILING SPACES
/ ;no formal arguments
strip-end-spaces ;function to strip spaces off ends of text
ent1 ;entity name for selected entity
elist1 ;entity list for selected entity
etype1 ;entity type for selected entity
val1 ;assoc 1 value for selected entity
val2 ;val1 after stripping blanks off ends
olderr ;old error handler
*error* ;internal error handler
) ;end of local variable list
(setq olderr *error*)
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;LCA - COMMENT: *error* defun no longer evaluates as a list.
;;LCA - COMMENT: *error* defun no longer evaluates as a list.
(defun *error* ( ;ERROR HANDLER FOR C:RES
)
(setq *error* olderr)
(princ st)
(princ)
) ;_ end of defun
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;; STRIP-END-SPACES - Remove preceeding and following spaces from <str>.
;;;
(defun strip-end-spaces ( ;STRIP SPACES OFF ENDS OF TEXT
str
/
)
(vl-string-trim " " str)
) ;_ end of defun
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;; START MAIN FUNCTION
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
(setq
ent1 (car (nentsel "\nSelect attribute or text: "

)
elist1 (entget ent1)
etype1 (cdr (assoc 0 elist1))
) ;_ end of setq
(if (or (= "ATTRIB" etype1) (= "TEXT" etype1))
(progn
(setq
val1 (assoc 1 elist1)
val2 (cons 1 (strip-end-spaces (cdr val1)))
elist1 (subst val2 val1 elist1)
) ;_ end of setq
(entmod elist1)
(if (= etype1 "attrib"

(entupd ent1)
) ;_ end of if
) ;end progn
(princ "\nEntity was not text or attribute "

) ;end if etype1 was an attrib?
(princ)
) ;end c:res
;::ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
(defun c:ate ( ;ATTEDIT ONE REPLACE
/ ;no formal arguments
texteval ;value of system variable to restore
) ;end of local variable list
(setq texteval (getvar "texteval"

)
(setvar "texteval" 1)
(while (setq ent (nentsel))
(command "attedit"

(command "Y" "*" "*" "*"

(command ent "v" "r" pause ""

) ;end while
(setvar "texteval" 1)
) ;end c:ate
(defun c:atm () ;ATTEDIT ONE MOVE
(while (setq ent (nentsel))
(command "attedit"

(command "Y" "*" "*" "*"

(command ent "p" pause ""

) ;end while
) ;end c:atm
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;;;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
(defun mod_attrib ( ;modify an attribute setting
elist ;entity name for the attrib
newval ;new assoc list
/ ;end of formal arguments
) ;end of local variable list
(entmod (subst
newval
(assoc (car newval) elist)
elist
) ;end subst
) ;end entmod
) ;end mod_attrib
(defun c:atc ( ;modify the color of an attribute
/ ;no formal arguments
ss1 ;selection set
) ;end of local variable list
(setq ss1 (ssadd))
(while (and
(setq ent (nentsel))
(setq
elist (entget (car ent))
temp (= "ATTRIB" (cdr (assoc 0 elist)))
) ;_ end of setq
) ;end if
(if temp
(setq ss1 (ssadd (car ent) ss1))
) ;_ end of if
) ;end while
(if (and
(setq newval (acad_colordlg 1 T))
(< 0 (sslength ss1))
) ;_ end of and
(mod_attrib_mult
ss1
(cons 62 newval)
) ;_ end of mod_attrib_mult
) ;end valid input
(princ)
) ;end c:atc
(defun c:atw ( ;modify the width of an attribute
/ ;no formal arguments
ss1 ;selection set
) ;end of local variable list
(setq ss1 (ssadd))
(while (and
(setq ent (nentsel))
(setq
elist (entget (car ent))
temp (= "ATTRIB" (cdr (assoc 0 elist)))
) ;_ end of setq
) ;end if
(if temp
(setq ss1 (ssadd (car ent) ss1))
) ;_ end of if
) ;end while
(if (and
(setq newval (getreal
(strcat
"\nNew width"
"<"
(rtos (cdr (assoc 41 elist)))
">."
) ;end strcat
) ;end getstring
) ;end setq
(< 0 (sslength ss1))
) ;_ end of and
(mod_attrib_mult
ss1
(cons 41 newval)
) ;_ end of mod_attrib_mult
) ;end valid input
(princ)
) ;end c:atw
(defun c:ath ( ;modify the height of an attribute
/ ;no formal arguments
ss1 ;selection set
) ;end of local variable list
(setq ss1 (ssadd))
(while (and
(setq ent (nentsel))
(setq
elist (entget (car ent))
temp (= "ATTRIB" (cdr (assoc 0 elist)))
) ;_ end of setq
) ;end if
(if temp
(setq ss1 (ssadd (car ent) ss1))
) ;_ end of if
) ;end while
(if (and
(setq newval (getreal
(strcat
"\nNew height"
"<"
(rtos (cdr (assoc 41 elist)))
">."
) ;end strcat
) ;end getstring
) ;end setq
(< 0 (sslength ss1))
) ;_ end of and
(mod_attrib_mult
ss1
(cons 40 newval)
) ;_ end of mod_attrib_mult
) ;end valid input
(princ)
) ;end c:ath
(defun mod_attrib_mult ( ;modify attribute setting for a selection set of attribs
ss1 ;selection set of attributes
newval ;new assoc list
/ ;end of formal arguments
) ;end of local variable list
(setq
ssl (sslength ss1)
indx -1
) ;_ end of setq
(while (> ssl (setq indx (1+ indx)))
(setq
ent (ssname ss1 indx)
elist (entget ent)
) ;_ end of setq
(entmod (if (assoc (car newval) elist)
(subst
newval
(assoc (car newval) elist)
elist
) ;end subst
(append
elist
(list newval)
) ;_ end of append
) ;end if
) ;end entmod
) ;end while
) ;end mod_attrib
(defun c:atca ( ;ATtribute Color All
/ ;no arguments
) ;end of local variable list
(atca
(cdr
(assoc
2
(entget
(car
(entsel
"\nSelect block to change attribute color: "
;select block
) ;_ end of entsel
) ;_ end of car
) ;_ end of entget
) ;_ end of assoc
) ;_ end of cdr
(acad_colordlg 0 T)
) ;_ end of atca
) ;_ end of defun
(defun atca ( ;change the color of all attributes within selected blocks
block ;name of block to scan
newcolor ;new attribute color
/ ;end of formal argument list
ss1 ;selection set of blocks
indx1 ;index to ss1 for current block
ent ;entity name for current block
elist ;entity list for current block
ent1 ;entity name for current sub-entity
attflag ;attributes follow flag for current block
;elist1; entity list for current sub-entity
etype1 ;entity type for current sub-entity
current ;attribute value for current attribute
) ;end of local variable list
(setq
ss1 (ssget (list (cons 2 block)))
newc newcolor
) ;_ end of setq
(if ss1
(progn
(setq indx1 -1)
(while (< (setq indx1 (1+ indx1)) (sslength ss1))
;while blocks in selection set
(setq
ent (ssname ss1 indx1)
ent1 ent
elist (entget ent)
attflag (if (assoc 66 elist)
T
nil
) ;_ end of if
) ;_ end of setq
(if attflag
(progn ;block has attributes
(setq
ent1 (entnext ent1)
elist1 (entget ent1)
etype1 (cdr (assoc 0 elist1))
) ;_ end of setq
(while (/= etype1 "SEQEND"

(if (= etype1 "ATTRIB"

(progn
(setq
elist1 (if (assoc 62 elist1)
(subst (cons 62 newcolor)
(assoc 62 elist1)
elist1
) ;_ end of subst
(append elist1 (list (cons 62 newcolor)))
) ;_ end of if
) ;_ end of setq
(entmod elist1)
) ;end progn, it's an attribute
) ;end if entity type?
(setq
ent1 (entnext ent1)
elist1 (entget ent1)
etype1 (cdr (assoc 0 elist1))
) ;_ end of setq
) ;end while not seqend
(entupd ent)
) ;end progn block has attributes
) ;end if attributes?
) ;end while not end of ss1
) ;end progn blocks exist
) ;end if blocks exist?
) ;end of defun atca
(defun c:atem ( ;attribute edit multiple
/ ;no formal arguments
) ;end of local variable list
(if
(and
(setq ss1 (ssget '((0 . "insert"

(66 . 1))))
(< 0 (setq ssl (sslength ss1)))
(setq
temp (princ "\nSelect attribute to edit: "

ent (nentsel)
) ;_ end of setq
(progn
(setq elist (entget (car ent)))
(= "ATTRIB" (cdr (assoc 0 elist)))
) ;_ end of progn
(setq newval (getstring T (strcat "<" (cdr (assoc 1 elist)) ">"

))
) ;end and valid input/selections
(progn
(setq
tag (cdr (assoc 2 elist))
indx -1
) ;_ end of setq
(while (> ssl (setq indx (1+ indx)))
(if *test*
(*break* "top of the while loop"

) ;_ end of if
(setq
ent (ssname ss1 indx)
elist (entget ent)
test T
) ;_ end of setq
(while test
(if *test*
(*break* "top of the second while loop"

) ;_ end of if
(setq
ent (entnext ent)
elist (entget ent)
) ;_ end of setq
(if (= tag (cdr (assoc 2 elist)))
(progn
(entmod (subst (cons 1 newval) (assoc 1 elist) elist))
(setq
test T
) ;_ end of setq
) ;end progn
(if (= "SEQEND" (cdr (assoc 0 elist)))
(setq test nil)
) ;end if seqend
) ;end if right attrib?
) ;end while looking for attrib
) ;end while working through ss1
(command "move" ss1 "" "0,0,0" ""

;regen the selection set
) ;end progn valid input
) ;end if valid input?
(princ)
) ;end c:atem
(defun c:athm ( ;attribute height multiple
/ ;no formal arguments
) ;end of local variable list
(if (and
(setq ss1 (ssget '((0 . "insert"

(66 . 1))))
(< 0 (setq ssl (sslength ss1)))
(setq
temp (princ "\nSelect attribute to modify: "

ent (nentsel)
) ;_ end of setq
(progn
(setq elist (entget (car ent)))
(= "ATTRIB" (cdr (assoc 0 elist)))
) ;_ end of progn
(setq newval (getdist (strcat "New height<"
(rtos (cdr (assoc 40 elist)))
">"
) ;_ end of strcat
) ;_ end of getdist
) ;_ end of setq
) ;end and valid input/selections
(progn
(setq
tag (cdr (assoc 2 elist))
indx -1
) ;_ end of setq
(while (> ssl (setq indx (1+ indx)))
(if *test*
(*break* "top of the while loop"

) ;_ end of if
(setq
ent (ssname ss1 indx)
elist (entget ent)
test T
) ;_ end of setq
(status ssl indx)
(while test
(if *test*
(*break* "top of the second while loop"

) ;_ end of if
(setq
ent (entnext ent)
elist (entget ent)
) ;_ end of setq
(if (= tag (cdr (assoc 2 elist)))
(progn
(entmod (subst (cons 40 newval) (assoc 40 elist) elist))
(setq
test T
) ;_ end of setq
) ;end progn
(if (= "SEQEND" (cdr (assoc 0 elist)))
(setq test nil)
) ;end if seqend
) ;end if right attrib?
) ;end while looking for attrib
) ;end while working through ss1
(command "move" ss1 "" "0,0,0" ""

;regen the selection set
) ;end progn valid input
) ;end if valid input?
(princ)
) ;end c:athm
(defun c:atsm ( ;attribute style multiple
/ ;no formal arguments
oldstyle
) ;end of local variable list
(if (and
(setq ss1 (ssget '((0 . "insert"

(66 . 1))))
(< 0 (setq ssl (sslength ss1)))
(setq
temp (princ "\nSelect attribute to modify: "

ent (nentsel)
) ;_ end of setq
(progn
(setq elist (entget (car ent)))
(= "ATTRIB" (cdr (assoc 0 elist)))
) ;_ end of progn
(setq
oldstyle (assoc 7 elist)
oldstyle (if oldstyle
(cdr oldstyle)
"STANDARD"
) ;_ end of if
temp (getstring (strcat "\nStyle<" oldstyle ">: "

)
newval (if (and (/= "" temp) (tblsearch "STYLE" temp))
temp
nil
) ;_ end of if
) ;_ end of setq
;;;input and verify replacement style name
) ;end and valid input/selections
(progn
(setq
tag (cdr (assoc 2 elist))
indx -1
) ;_ end of setq
(while (> ssl (setq indx (1+ indx)))
(if *test*
(*break* "top of the while loop"

) ;_ end of if
(setq
ent (ssname ss1 indx)
elist (entget ent)
test T
) ;_ end of setq
(status ssl indx)
(while test
(if *test*
(*break* "top of the second while loop"

) ;_ end of if
(setq
ent (entnext ent)
elist (entget ent)
) ;_ end of setq
(if (= tag (cdr (assoc 2 elist)))
(progn
(entmod (if (assoc 7 elist)
(subst (cons 7 newval) (assoc 7 elist) elist)
(append elist (cons 7 newval))
) ;_ end of if
) ;_ end of entmod
(setq
test T
) ;_ end of setq
) ;end progn
(if (= "SEQEND" (cdr (assoc 0 elist)))
(setq test nil)
) ;end if seqend
) ;end if right attrib?
) ;end while looking for attrib
) ;end while working through ss1
(command "move" ss1 "" "0,0,0" ""

;regen the selection set
) ;end progn valid input
) ;end if valid input?
(princ)
) ;end c:atsm
(defun status ( ;WRITE STATUS TO STATUS LINE
max
now
)
(grtext -2
(strcat
(rtos (/ now max 0.01) 2 2)
"%"
) ;end strcat
) ;end grtext
) ;end status
(defun c:attpresuf ( ;add prefix and suffixe to multiple attributes
/ ;no formal arguments
*test* elist ent indx pref ss1 ssl suf tag temp test)
;end of local variable list
(if (and
(setq
temp (princ "\nSelect blocks: "

ss1 (ssget '((0 . "insert"

(66 . 1)))
) ;_ end of setq
(< 0 (setq ssl (sslength ss1)))
(setq
temp (princ "\nSelect attribute to edit: "

ent (nentsel)
) ;_ end of setq
(progn
(setq elist (entget (car ent)))
(= "ATTRIB" (cdr (assoc 0 elist)))
) ;_ end of progn
(setq
pref (getstring
T
(strcat "Prefix to add:<" (cdr (assoc 1 elist)) ">"

) ;_ end of getstring
) ;_ end of setq
(setq
suf
(getstring
T
(strcat "Suffix to add:<" pref (cdr (assoc 1 elist)) ">"

) ;_ end of getstring
) ;_ end of setq
) ;end and valid input/selections
(progn
(setq
tag (cdr (assoc 2 elist))
indx -1
) ;_ end of setq
(while (> ssl (setq indx (1+ indx)))
(if *test*
(*break* "top of the while loop"

) ;_ end of if
(setq
ent (ssname ss1 indx)
elist (entget ent)
test T
) ;_ end of setq
(while test
(if *test*
(*break* "top of the second while loop"

) ;_ end of if
(setq
ent (entnext ent)
elist (entget ent)
) ;_ end of setq
(if (= tag (cdr (assoc 2 elist)))
(progn
(entmod (subst
(cons 1
(strcat pref (cdr (assoc 1 elist)) suf)
) ;_ end of cons
(assoc 1 elist)
elist
) ;_ end of subst
) ;_ end of entmod
(setq
test T
) ;_ end of setq
) ;end progn
(if (= "SEQEND" (cdr (assoc 0 elist)))
(setq test nil)
) ;end if seqend
) ;end if right attrib?
) ;end while looking for attrib
) ;end while working through ss1
(command "move" ss1 "" "0,0,0" ""

;regen the selection set
) ;end progn valid input
) ;end if valid input?
(princ)
) ;end c:atem
;;;mattprop modifies the properties of attribute entities
;;; if the property is a point then the new value is in the
;;; object coordinate system.
;|
(defun mattprop( ;modify attribute properties
bname ;block name
tag ;attribute tag
newval ;new attribute property value
dxfcode ;dxf code for the property
/ ;end of formal argument list
) ;end of local variable list
(if (and
(setq ss1 (ssget (list (cons 0 "INSERT"

(cons 2 bname) '(66 . 1))))
(< 1 (setq ssl (sslength ss1)))
) ;end and found the correct block
(progn
(setq indx -1)
(while (> ssl (setq indx (1+ indx)))
(setq
ent (ssname ss1 indx)
|;
(progn
(princ
"\Attrib.lsp (c)1998 Michael Weaver dba AlasCad\n1073 Badger Road, Fairbanks, Alaska 99705\nalascad@go.com"
) ;_ end of princ
) ;_ end of progn
Atleast the part about globeally changing attribs right just change it to get the attribs justification point if everyone helps everybody the world will be a better place