I need a LISP program to add a text given by user to all selected text.
in other words:
1- user selects some texts.
2- user give a text to program.
3- Program added this text to all selected text.
selected text: text1, text2, text3,text4,....,textn
given text by user: _xyz
text1_xyz, text2_xyz, text3_xyz,text4_xyz,....,textn_xyz
Can anybody help me?
Solved! Go to Solution.
maybe something like
(defun c:test (/ ss nstr str itm obj) (vl-load-com) (prompt "\nSelect texts to adda string: ") (if (and (setq ss (ssget "_:L" '((0 . "TEXT")))) (setq nstr (getstring "\nEnter the string to add to the text: ") ) ) (repeat (setq itm (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq itm (1- itm)))) ) (setq str (vla-get-textstring obj)) (vla-put-textstring obj (strcat str nstr)) );; repeat );; if (princ) )
hope that helps
(defun c:Asuf ( / suf ss i e st l) (while (not (progn (setq suf (getstring T "\nEnter string to add: ")) (if ( eq suf "") nil suf )))) (if (setq ss (ssget "_X" '((0 . "*TEXT")))) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i)))) st (cdr (assoc 1 e)) l (assoc -1 e)) (entmod (list (cons 1 (strcat st suf)) l))) )(princ) )
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.