Author Topic: Find and replace text - mtext with /p  (Read 2475 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Find and replace text - mtext with /p
« on: April 29, 2015, 04:14:06 PM »
I have been looking all day with no such luck. I am looking for a simple lisp that can do a simple find and replace of mtext.

The mtext value says (SHEET\PTITLE\P----) and I would like to be able to do a find and replace if that is possible? I have found some other lisps but they mostly do one word string not multiple. I know I could use the dialogue box, but this will be inside one of the macros I am creating.

Any help would be great! Thanks again for your help.
Civil3D 2020

ymg

  • Guest
Re: Find and replace text - mtext with /p
« Reply #1 on: April 29, 2015, 05:10:40 PM »
MSTG,

Could it be simply in the way you specified your search string ?

Code: [Select]
((-1 . <Entity name: 7fffedf1650>) (0 . "MTEXT") (330 . <Entity name: 7ffff6069f0>) (5 . "3D10D") (100 . "AcDbEntity") (67 . 0)
(410 . "Model") (8 . "TIN Natural Ground") (100 . "AcDbMText") (10 164411.0 91171.7 0.0) (40 . 1.0) (41 . 14.4123) (46 . 0.0)
 (71 . 1) (72 . 5) (1 . "SHEET\\PTITLE\\PBLAH BLAH") (7 . "Standard") (210 0.0 0.0 1.0) (11 1.0 0.0 0.0) (42 . 7.47203) (43 . 4.35107)
 (50 . 0.0) (73 . 1) (44 . 1.0))

(wcmatch (cdr (assoc 1 (entget en))) "SHEET\\PTITLE*")

returns T for the entity above.


ymg
« Last Edit: April 29, 2015, 05:14:40 PM by ymg »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Find and replace text - mtext with /p
« Reply #2 on: April 29, 2015, 07:40:16 PM »
That should work although I would add another asterisk
Code: [Select]
(wcmatch (cdr (assoc 1 (entget (CAR (ENTSEL))))) "*SHEET\\PTITLE*")
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Re: Find and replace text - mtext with /p
« Reply #3 on: April 29, 2015, 08:05:02 PM »
Thank you so much guys for looking at this. Awesome!
Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Find and replace text - mtext with /p
« Reply #4 on: April 30, 2015, 03:38:22 AM »
This post may help to explain why the extra backslash is required.

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Re: Find and replace text - mtext with /p
« Reply #5 on: April 30, 2015, 12:37:22 PM »
I am sure I am missing something here. Everything worked like you guys said. But I went to place the command that I have into the macro and it errors out
Code: [Select]
(tfindfun "SHEET, the original code is this
Code: [Select]
(load "tfind");(tfindfun "SHEET\\PTITLE\\P----" "GRADING PLAN" 0)
Any idea what I might be doing wrong?
Thanks!
Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Find and replace text - mtext with /p
« Reply #6 on: April 30, 2015, 12:52:51 PM »
Since "\" represents a pause in a macro, you may need to use:
Code - Text: [Select]
  1. (load "tfind");(tfindfun (strcat "SHEET" (chr 92) "PTITLE" (chr 92) "P----") "GRADING PLAN" 0)

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Re: Find and replace text - mtext with /p
« Reply #7 on: April 30, 2015, 12:56:40 PM »
I did not know that. Thank you again
Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Find and replace text - mtext with /p
« Reply #8 on: April 30, 2015, 01:17:16 PM »
You're welcome!  :-)