×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

match text string

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

RE: match text string

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

RE: match text string

(OP)
Farzad,
Thanks a bunch. The routine works like a charm.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources