Hunter Posted February 24, 2009 Share Posted February 24, 2009 Hi Lee, it's wonderful~ Is it possible that the user can selecet the textstyle from dialogue box and keyin to decide the height? Much appreciate~ For instance to change all text and mtext to Verdana with height 4.5: (defun txtchng (sNme Ht / ss) (vl-load-com) (if (and (tblsearch "STYLE" sNme) (setq ss (ssget "X" (list (cons 0 "TEXT,MTEXT") (if (getvar "CTAB")(cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE")))))))) (progn (setq ss (mapcar 'entget (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))) (foreach e ss (entmod (subst (cons 7 sNme) (assoc 7 e) (subst (cons 40 Ht) (assoc 40 e) e))))) (princ "\n<!> No Text Found or Verdana Style Doesn't Exist <!>")) (princ)) (defun c:test () (txtchng "VERDANA" 4.5) (princ)) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 24, 2009 Share Posted February 24, 2009 A Dialog Box eh... that may take slightly longer... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 24, 2009 Share Posted February 24, 2009 Perhaps something like this? Make sure you put the DCL in ACAD search path and run LISP as normal. TextChanger.zip Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 24, 2009 Share Posted February 24, 2009 Sorry, posted too soon as usual.... here is better: Type TXCH to run. Text Changer.zip Quote Link to comment Share on other sites More sharing options...
CAB Posted February 24, 2009 Share Posted February 24, 2009 To answer your question to me. (defun txtchng (sNme Ht / ss elst_list lst) (vl-load-com) (if (and (tblsearch "STYLE" sNme) (setq ss (ssget "X" (list (cons 0 "TEXT,MTEXT") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))) )))) ) (progn ;; (vl-remove-if 'listp is only needed when the user selects the ss ;; so when not using window to get the ss, don't need to use it ;; although its only penalty for using it is time (setq elst_list (mapcar 'entget (mapcar 'cadr (ssnamex ss)))) (foreach lst elst_list (mapcar '(lambda (new old) (setq lst (subst new old lst))) (list (cons 7 sNme)(cons 40 Ht)) (list (assoc 7 e)(assoc 40 e)) ) (entmod lst) ) ) (princ "\n<!> No Text Found or Verdana Style Doesn't Exist <!>") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 24, 2009 Share Posted February 24, 2009 Ahh, yes - thanks CAB for the advice. I didn't think a lambda function was needed, as I provided the subst with the arguments it needed in LISP form, but obviously this is a better way to do it. Thanks once again Lee Quote Link to comment Share on other sites More sharing options...
CAB Posted February 24, 2009 Share Posted February 24, 2009 The problem is using subst which requires 3 arguments. Using Mapcar without lambda does not lend itself to this application. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 24, 2009 Share Posted February 24, 2009 I see, just need to choose the correct tool for the job Thanks CAB. Quote Link to comment Share on other sites More sharing options...
Hunter Posted February 25, 2009 Share Posted February 25, 2009 Thanks Lee~ It's marvelous! Would u please tell me how to add ACAD search path? It seems to be work only when I put the DCL in C:\Program Files\AutoCAD 2006\Support . Regards~ Perhaps something like this? Make sure you put the DCL in ACAD search path and run LISP as normal. Quote Link to comment Share on other sites More sharing options...
Hunter Posted February 25, 2009 Share Posted February 25, 2009 forgiev my ignorance, I find the answer here: http :discussion.autodesk.com/forums/message.jspa?messageID=5533620 Go to: Options Files tab Support Files Search Path Add Browse (select the folder where you installed the program. Re-Load and Re-Run the program and it should work. Thanks Lee~It's marvelous! Would u please tell me how to add ACAD search path? It seems to be work only when I put the DCL in C:\Program Files\AutoCAD 2006\Support . Regards~ Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 25, 2009 Share Posted February 25, 2009 No worries, glad you like it I normally have a folder in my docs entitled "ACAD Search Path", and locate this in ACAD - then I can quickly just dump dcls and lsps in there with ease. Glad you like it - if you have any further questions, just ask Cheers Lee Quote Link to comment Share on other sites More sharing options...
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.