• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

liisp for text replacement and insert new text

  • Thread starter Thread starter marcmemba
  • Start date Start date
  • Tags Tags
    lisp

marcmemba

Guest
Hello, everyone!

I am making a lisp program, which inserts me a _text (see next row):

(command)_text"use" 1.5 " datatext)

in autocad (i.e. it inserts of the dairy in the dwg subforms new text)

I wanted to know if it was possible that the output data instead of being inserted in the dwg as new text (as above), can go to replace another text already present in the drawing? in the sense that I select a text and then it is replaced with the value of datatext ...

I hope you understand my problem and someone can help me

thanks in advance and good evening

Marc
 
I tried to read the two examples published on the page linked in the answer above, I took stock from the second lsp, but I can't apply it to my code... How could I do... Premetto is only a few weeks ago that I am devoting myself to lsp
Thank you so much!!
 
perhaps then it is easier in vanilla autolisp:

(setq datatext "pippo")
(setq txt (entget (car (entsel "\nselect the text to edit: ")))
(entmod (subst (cons 1 datatext) (assoc 1 txt) txt))
 
thank you very much for the car:)

One second thing I wanted to ask. . .

I would like to be able to choose when to insert a new text and when to replace existing text

where I am required by the program: ---- Do you want to insert a new text? (s/n) ---- if I reply ----s---- lsp performs the following function:

(setq datatext "unused")

(command "_text" breaks "1.5" datatext breaks)

while if I answer ----n---- performs the following function

(setq txt (entget (car (entsel "\nselect the text to edit: ")))

(entmod (subst (cons 1 datatext) (assoc 1 txt) txt))

and replaces an existing text...

It is possible to do so (at least I hope...) because I have seen that there is the function if ... and I am convinced that it is done with this, but I cannot start:(

Thanks again! and good evening!
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top