kam1967 Posted February 5, 2009 Author Posted February 5, 2009 Lee, if I were to not use the variable that is in Autocad itself, but wanted to replace the value for attribute DRAWINGNAME with only the text "UPDATED" - how would you modify the routine that you've just written? If I have this routine, it will help me update any blocks with either the a system variable or a regular text. No hurry, as I think it's close to midnight maybe in England? As always, thank you. Quote
Lee Mac Posted February 5, 2009 Posted February 5, 2009 Thanks, Lee. I tested your routine and I got an extra right parenthesis error. I took away the other two on the right and it works fine now. (entmod (subst (cons 1 dNme)(assoc 1 aEntLst) aEntLst))) (entupd e) (setq aEnt (entnext aEnt))))) (princ "\n No Title Blocks Found ")) ;(command "_regenall") (princ)) Well, this has been most educational. Thanks for the input, everyone! Have a wonderful day, okay? Grab some zZzZ too! Hmm... I checked the updated routine that I posted and parenthesis number seems correct Quote
kam1967 Posted February 5, 2009 Author Posted February 5, 2009 You're welcome to test it, Lee. I know, it's tough being a perfectionist, isn't it? Quote
Lee Mac Posted February 5, 2009 Posted February 5, 2009 Again, untested: (defun c:dwgupd (/ ss ans eLst dNme aEnt aEntLst) (vl-load-com) (if (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 2 "TITLE") (cons 66 1) (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (if (not oans) (setq oans "Filename")) (initget "Filename Updated") (setq ans (getkword (strcat "\nFilename or Updated? {F/U} <" oans ">: "))) (if (eq "" ans) (setq ans oans) (setq oans ans)) (if (eq ans "Filename") (setq dNme (vl-filename-base (getvar "DWGNAME"))) (setq dNme "UPDATED")) (setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (foreach e eLst (setq aEnt (entnext e)) (while (not (eq "SEQEND" (cdadr (setq aEntLst (entget aEnt))))) (if (= "DRAWINGNAME" (cdr (assoc 2 aEntLst))) (entmod (subst (cons 1 dNme)(assoc 1 aEntLst) aEntLst))) (setq aEnt (entnext aEnt))))) (princ "\n<!> No Title Blocks Found <!> ")) (command "_regenall") (princ)) Off to bed now to catch some Zzzzs Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.