;;;Conditional Attribute update subroutine (attupd [blockname] [attribname] [newvalue] [condition] [testvalue]) ;;;checks current attrib value for [condition] against [testvalue]. If True, attrib is updated with [newvalue] ;;;Used extensively in scripts to rapidly change title block fill-ins. ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 4-22-97 ;;;> EDITED: 10-07-2002 ;;; (defun condattupd (blockname attribname newvalue condition testvalue / ttl1ss iniblk inient nxtent) (IF (NOT (MEMBER condition (LIST = < > <= >= /= EQ EQUAL eq equal wcmatch WCMATCH))) NIL (PROGN (setq ttl_exst nil bstp 0) (if (setq ttl1ss (ssget "x" (list (cons -4 "") ) ) ;_ end of ssget ) ;_ end of setq ; (while (< bstp (sslength ttl1ss)) (progn (setq iniblk (ssname ttl1ss bstp)) (setq inient (entget iniblk)) (setq nxtent (entget (entnext iniblk))) (while (/= (cdr (assoc 0 nxtent)) "SEQEND") (if (eq (cdr (assoc 0 nxtent)) "ATTRIB") (if (eq (strcase(cdr (assoc 2 nxtent)))(strcase attribname)) (if (condition (cdr(assoc 1 nxtent)) testvalue) (progn (setq nxtent (subst (cons 1 newvalue) (assoc 1 nxtent) nxtent) ) ;_ end of setq (entmod nxtent) (entupd iniblk) ) ;_ end of progn ) (if (eq (strcase(cdr (assoc 2 nxtent)))"SHT_NO.") (setq cur_sht_no (cdr(assoc 1 nxtent))) ) ) ;_ end of if ) ;_ end of if (setq nxtent (entget (entnext (cdar nxtent)))) ) ;_ end of while (princ) ) ;_ end of progn ; (setq bstp (1+ bstp)) ; ) (princ) ) ;_ end of if )) (princ) ) ;_ end of defun