j_spawn_h Posted July 5, 2015 Share Posted July 5, 2015 (edited) Tharwat wrote the add text at the bottom. Which works great. Thank you! I wanted to add dialog box to add text or replace text in different places of existing text. I got it to work but I can't seem to write how not to add the text if it is already there. Example: if I had the suffix then add the suffix again it will add it not change it. I have more than one choice for suffixs and prxs. But 2 suffixs can't be in the same text string. Also I do I loop this so after I make my pick in the box I can go around and touch as many as I want to change. (defun c:Test (/ ss l sset str e suffixs prxs) (setq lstprxs '("CANT" "NOTHING") lstsuffixs '("FRB" "UWA" "UCA" "NOTHING"));end setq (or prxs (setq prxs (car lstprxs))) (or suffixs (setq suffixs (car lstsuffixs))) (setq dcl_id (load_dialog "textest.dcl")) (if (not (new_dialog "textest" dcl_id)) (exit)) (progn (set_tile prxs "1") (set_tile suffixs "1") (action_tile "prxs" "(setq prxs $value)") (action_tile "suffixs" "(setq suffixs $value)"));end progn (start_dialog) (unload_dialog dcl_id) (if (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT")))) (repeat (setq l (sslength ss)) (setq sset (ssname ss (setq l (1- l)))) (setq str (cdr (assoc 1 (setq e (entget sset))))) (entupd (cdr (assoc -1 (setq rr(entmod (subst (cons 1 (strcat prxs str suffixs )) (assoc 1 e) e))) ) ) ) ) (princ) ) (princ) ) Edited July 5, 2015 by j_spawn_h Add some text,changed title Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 6, 2015 Share Posted July 6, 2015 A couple of ways you can use a Vl-string-search to see if it exists, check the correct number of characters as prefix or suffix use (substr string start end) (substr "abcdfghk" 1 3) = abc, if this is wrong wcmatch also. 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.