Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

adding a text to selected texts

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
aqdam1978
476 Views, 6 Replies

adding a text to selected texts

Hi,

 

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

Result:

text1_xyz, text2_xyz, text3_xyz,text4_xyz,....,textn_xyz

 

Can anybody help me?

 

Thanks.

 

 

6 REPLIES 6
Message 2 of 7
hmsilva
in reply to: aqdam1978

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

 

Henrique

EESignature

Message 3 of 7
3wood
in reply to: aqdam1978

You can try ALTEXT.vlx,

just set "_xyz" as suffix.

altext.png

Message 4 of 7
aqdam1978
in reply to: hmsilva

Hi hmsilva,

 

Your program is GREAT.

 

Thank you very much.

 

Message 5 of 7
aqdam1978
in reply to: 3wood

Hi 3wood,

 

where can I find the "ALTEXT.vlx" file.

is this file free or I should buy it?

 

Thanks

Message 6 of 7
hmsilva
in reply to: aqdam1978

You're welcome,  aqdam1978

EESignature

Message 7 of 7
pbejse
in reply to: aqdam1978

anothter

 

(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)
)

 

HTH

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost