Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

match text string

Status
Not open for further replies.

gadero

Electrical
May 30, 2003
23
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
 
Replies continue below

Recommended for you

Dear gadero,
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
 
Farzad,
Thanks a bunch. The routine works like a charm.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor