Can anyone tell me if there's a better way to do this (particularly FLD3)? The COND statement looks weird like it is. Itk's supposed to look in the filename and see if there's certain letters in it and label the title block accordingly. i.e., "WD" in the filename gives the drawing description "Wiring Diagram"...
Thanks
Code:(defun c:UTB (/ ss att fld1 fld2 fld3) (setq fld1 (eval "%<\\AcVar Login \\f \"%tc1\">%")) (setq fld2 (eval "%<\\AcVar CreateDate \\f \"M/d/yyyy\">%")) (cond ((wcmatch (getvar dwgname) "PD") (setq fld3 (strcat "PIPING DIAGRAM"))) ((wcmatch (getvar dwgname) "HL") (setq fld3 (strcat "HEADER LAYOUT"))) ((wcmatch (getvar dwgname) "CL") (setq fld3 (strcat "COMPRESSOR LAYOUT"))) ((wcmatch (getvar dwgname) "CHL") (setq fld3 (strcat "COMPRESSOR HEADER LAYOUT"))) ((wcmatch (getvar dwgname) "WD") (setq fld3 (strcat "WIRING DIAGRAM"))) ((wcmatch (getvar dwgname) "KS1") (setq fld3 (strcat "HOUSE PLAN VIEW"))) ((wcmatch (getvar dwgname) "KS2") (setq fld3 (strcat "HOUSE LIFTING & ELEVATION"))) ((wcmatch (getvar dwgname) "KS3") (setq fld3 (strcat "HOUSE BASE"))) ((wcmatch (getvar dwgname) "KS4") (setq fld3 (strcat "HOUSE WALLS"))) ((wcmatch (getvar dwgname) "KS5") (setq fld3 (strcat "HOUSE ROOF"))) ((wcmatch (getvar dwgname) "KS6") (setq fld3 (strcat "CONDENSER SUPPORT"))) ((wcmatch (getvar dwgname) "KS7") (setq fld3 (strcat "CATWALK"))) ((wcmatch (getvar dwgname) "KS8") (setq fld3 (strcat "HANDRAILS"))) ((wcmatch (getvar dwgname) "KS9") (setq fld3 (strcat "SHEETMETAL LAYOUT"))) ((wcmatch (getvar dwgname) "KS10") (setq fld3 (strcat "CURB"))) ((wcmatch (getvar dwgname) "KE1") (setq fld3 (strcat "ELECTRICAL PLAN VIEW"))) ((wcmatch (getvar dwgname) "KE2") (setq fld3 (strcat "LINE DIAGRAM & PANEL SCHEDULES"))) ((wcmatch (getvar dwgname) "KE3") (setq fld3 (strcat "HOUSE CONTROLS DIAGRAM"))) ((wcmatch (getvar dwgname) "KE4") (setq fld3 (strcat "DEFROST PANEL WIRING DIAGRAM"))) ((wcmatch (getvar dwgname) "KM1") (setq fld3 (strcat "HOUSE PIPING DIAGRAM"))) ((wcmatch (getvar dwgname) "FAN") (setq fld3 (strcat "MACHINE HOUSE FAN WIRING"))) ((wcmatch (getvar dwgname) "LTC") (setq fld3 (strcat "LIGHTING CONTACTOR WIRING"))) ((wcmatch (getvar dwgname) "WTP") (setq fld3 (strcat "WATER TANK PIPING"))) ((wcmatch (getvar dwgname) "WPW") (setq fld3 (strcat "WATER PUMP WIRING"))) ) (if (setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "*BORDER*") (cons 66 1)(if (getvar "CTAB")(cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (foreach ent (mapcar 'cadr (ssnamex ss)) (setq att (entnext ent)) (while (not (eq "SEQEND" (cdadr (entget att)))) (cond ((eq "DRAWNBY" (cdr (assoc 2 (entget att)))) (entmod (subst (cons 1 fld1) (assoc 1 (entget att)) (entget att)))) ((eq "DRAWNDATE" (cdr (assoc 2 (entget att)))) (entmod (subst (cons 1 fld2) (assoc 1 (entget att)) (entget att)))) ((eq "DESCRIPTION" (cdr (assoc 2 (entget att)))) (entmod (subst (cons 1 fld3) (assoc 1 (entget att)) (entget att)))) ) (setq att (entnext att)))) (command "_regenall")) (princ "\n<!> No Blocks Found <!>"))