; ** 09-Mar-09 NEHolt (defun attrib_resize ( blockname attrname texthgt textwidth / ss slen block_en ix enn edd) ; PURPOSE - modify attribute height and/or width of target attribute name ; on all instances of block "blockname" on active drawing. ; "blockname" = target blockname, wild-cards okay ; "attrname" = target attribute name, wild-cards okay ; texthgt = new height (nil=do not adjust existing height) ; textwidth = new width factor (nil=do not adjust existing width) (if (AND blockname attrname) (progn (if (AND texthgt (= (type texthgt) 'STR))(setq texthgt (atof texthgt))) (if (AND textwidth (= (type textwidth) 'STR))(setq textwidth (atof textwidth))) ; Create selectioin set of all block instances on active drawing ; that wild-card match "blockname" argument. (setq ss (ssget "_X" (list (cons -4 "")))) (if (/= ss nil) (progn ; one or more instances of target block found (setq slen (sslength ss)) ; number of instances (setq ix 0) ; index pointer (while (< ix slen) (setq block_en (ssname ss ix)) (setq ix (1+ ix)) ; increment pointer for next time ; Cycle through block instance, look for target attribute (if (setq enn (entnext block_en)) (setq edd (entget enn))) (while (AND enn (/= (cdr (assoc 0 edd)) "SEQEND") (/= (cdr (assoc 0 edd)) "INSERT") ) (if (AND (= (cdr (assoc 0 edd)) "ATTRIB") (wcmatch (cdr (assoc 2 edd)) attrname)) (progn ; Found instance of target attribute (if texthgt (progn ; adjust text height (setq edd (subst (cons 40 texthgt)(assoc 40 edd) edd)) ) ) (if textwidth (progn ; adjust text width (setq edd (subst (cons 41 textwidth)(assoc 41 edd) edd)) ) ) (if edd (progn (entmod edd) ; write new data back to attribute (entupd enn) ) ) ) ) ; Advance to next subentity in this block insert instance (if (setq enn (entnext enn)) (setq edd (entget enn))) ) ) ) ) ) ) (princ) )