match text string
match text string
(OP)
I'm looking for a routine that will allow me to select text (source of text string) and select a second text and automatically match the second text string to the first text string.
Not sure if I'm explaining this well. So, lets say I have two separate text strings...text 1 = "this is an example", text 2 = "to illustrate what I'm trying to describe".
I'd like to be able to select text 1 and then select text 2....the routine would change text 2 from "to illustrate what I'm trying to describe" to "this is an example".
Thanks
Not sure if I'm explaining this well. So, lets say I have two separate text strings...text 1 = "this is an example", text 2 = "to illustrate what I'm trying to describe".
I'd like to be able to select text 1 and then select text 2....the routine would change text 2 from "to illustrate what I'm trying to describe" to "this is an example".
Thanks





RE: match text string
The following autolisp code will perform what you need.
after loading the code, just enter CTEXT in the command line and select two strings.
(defun c:ctext(/ str1 ent1)
(setq str1 (cdr (assoc 1 (entget (car (entsel "\nFirst string: "))))))
(setq ent1 (entget (car (entsel "\nSecond string: "))))
(setq ent1 (subst (cons 1 str1) (assoc 1 ent1) ent1))
(entmod ent1)
(princ)
)
Regards,
Farzad
RE: match text string
Thanks a bunch. The routine works like a charm.