Find/Replace MText Carriage Return

ebsoares
Collaborator

Find/Replace MText Carriage Return

ebsoares
Collaborator
Collaborator

Hi, everyone.

 

There're a ton of MText elements where I would like to replace a specific set of characters, say "__" (double underscores) with a carriage return.

 

Forums around the web say to replace it with "\P" (case sensitive), but this does not work. When I replace them with "\P", the Mtext actually shows the "\P" in there, instead of inserting a carriage return.

 

And, if you select the Mtext and look at "Contents" property it shows "\\P" (double backslashes).

 

For example:

  • Initial Mtext: "TOP LINE__BOTTOM LINE"
  • Find/Replace "__" with "\P"
  • Mtext result: "TOP LINE\PBOTTOM LINE"
    • "Contents" property: "TOP LINE\\PBOTTOM LINE"

Does anyone know how to accomplish this?

 

Thanks in advance,

 

Edgar

0 Likes
Reply
Accepted solutions (1)
7,847 Views
3 Replies
Replies (3)

Kent1Cooper
Consultant
Consultant

Try replacing it with "\\P" with the double  backslash.  A backslash is a control character, and to get it to read it as a backslash, it needs another.  Even though in the Properties palette display of contents it may show  like this:

 

THIS IS\PA TEST

 

if you look at the actual content as stored in entity data, it looks like this:

 

(1 . "THIS IS\\PA TEST")

Kent Cooper, AIA
0 Likes

ebsoares
Collaborator
Collaborator
Accepted solution

Hi, Kent. Thanks for the tip... but it didn't work...

 

If we replace it instead with "\\P", then the Mtext shows "TOP LINE\\PBOTTOM LINE" and the "Contents" property shows something like this: "TOP LINE\\\\PBOTTOM LINE" (four backslashes).

 

But here, I found this forum where Rodolfo found the answer: "Add an 'Enter' using Find and Replace" - instead of "\P" we should use the Unicode "\U+000A". I just tested it and it works!!! Smiley Very Happy

 

Either way, thanks again for the tip, Kent - your help has always been awesome!

 

Edgar

stephanYN6LU
Participant
Participant

It is still a pain in the but to find/replace Mtext in autocad even with the "\U+000A" function (which it does work), especially when you have to edit a lot of drawings through a lisp routine. The problem I face then, although the text have been replaced, it makes it a weird format, until you go into that mtext edit and exit afterwards without editing, and then the layout will readjust to the correct format.

stephanYN6LU_0-1654780491726.png

Above is an example before going into the editor, and below is what happens if I do what I have described

stephanYN6LU_1-1654780620325.png

stephanYN6LU_2-1654780634430.png

 

Please take note I haven't made any changes except going into the editor and exiting. It is a bit annoying to fix the layout, I hope the devs can make our lives a lot easier with a patch to fix this issue.