Mtext lines formatted differently, Find-Replace screwing up

Mtext lines formatted differently, Find-Replace screwing up

s60088g
Advocate Advocate
464 Views
8 Replies
Message 1 of 9

Mtext lines formatted differently, Find-Replace screwing up

s60088g
Advocate
Advocate

I use an mtext with a larger text in the first line and smaller in the second.  When using Find and Replace, the 2nd line is partially picking up formatting from above. I tried removing Columns which was set up in the mtext already (hate that anyway).  No solution found.  I hope that someone might have an idea.  I chose to Find "Electrical First Floor Plan Partial" and Replace with "Electrical Plan Partial."  Something so simple is causing a headache. 

Mtext lines.jpg

0 Likes
465 Views
8 Replies
Replies (8)
Message 2 of 9

ronjonp
Mentor
Mentor

What happens if you replace "AL FIRST FL" with "AL FL" ?

You might post a drawing .. sounds like you might have some heavy internal formatting.

0 Likes
Message 3 of 9

s60088g
Advocate
Advocate

I just saved the text in a file to attach here.  Thanks.  And I mistyped the order of the words which is irrelevant.  Anyway, have a look.  Thank you!

0 Likes
Message 4 of 9

nrz13
Advisor
Advisor

I can confirm this bug in AutoCAD 2022.1 using new MTEXT in a new drawing (did not use yours).  No matter that the second line has been hard-returned with the Enter key, find and replace of the middle words on the first line drops the "OPTIO" down to the second line.

Note that the "N" remains small when I tried it.  I've tried it with standard Windows fonts Arial and Verdana, as well as with bold, italic, and underline.  All exhibit the same bug.

I'd be interested to see if anyone has a workaround for this bug.  Be sure to report it through your Autodesk Account.


Work:  AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-8700K, 32GB RAM, Samsung 960 Pro SSD, AMD Radeon Pro WX 5100, 3 Dell Monitors (3840x2160)
Home: AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-11700, 64GB RAM, Samsung 980 Pro SSD, NVIDIA Quadro P2200, Dell Monitor (3840x2160)
Message 5 of 9

pendean
Community Legend
Community Legend
@s60088g Expand FIND command (find the little arrow button on the pop-up): those expanded list of options are all you can do with the stock command. I don't see a fix to what you wish, but I've not rigorously tested it either.
0 Likes
Message 6 of 9

nrz13
Advisor
Advisor

Best workaround I have at the moment is to find and replace the selection with a bunch of spaces (try 5 to 10), then replace the number of spaces (+1) with a single space.  It's ugly, but relatively fast if you have a lot of them to change.  Hopefully a better workaround emerges...


Work:  AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-8700K, 32GB RAM, Samsung 960 Pro SSD, AMD Radeon Pro WX 5100, 3 Dell Monitors (3840x2160)
Home: AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-11700, 64GB RAM, Samsung 980 Pro SSD, NVIDIA Quadro P2200, Dell Monitor (3840x2160)
0 Likes
Message 7 of 9

s60088g
Advocate
Advocate

Haha, thanks!  😊  I just changed the titles all by hand... all 45+   !!!

 

I did wonder if a 'return' was the issue.  It's so odd.  It's handy to use one Mtext with a hierarchy of font sizes rather than individual lines.

 

 

0 Likes
Message 8 of 9

ronjonp
Mentor
Mentor

It does appear to be a bug ... I manually formatted the text ( which is different than the original ) but the find and replace still messes it up.

;; RJP manually formatted
"{\\H0.75x;\\LFIRST FLOOR ELECTRICAL PARTIAL}\\P{\\H0.5x;OPTIONAL 3-CAR SIDELOAD GARAGE\\P\\H0.75x;SCALE: 1/4\" = 1'-0\"}"
;; After replacement
"{\\H4x;ELECTRICAL PLAN PARTIAL\\POPTION\\H0.66667x;AL 3-CAR SIDELOAD GARAGE\\P\\H0.75x;SCALE: 1/4\" = 1'-0\"}"
;; Formatted text in drawing
"{\\H0.75x;\\LFIRST FLOOR ELECTRICAL PARTIAL\n\\H0.66667x;\\lOPTIONAL 3-CAR SIDELOAD GARAGE\n\\H0.75x;SCALE: 1/4\" = 1'-0\"}"
;; After replacement
"{\\H0.75x;\\LELECTRICAL PLAN PARTIAL\nOPTION\\H0.66667x;\\lAL 3-CAR SIDELOAD GARAGE\n\\H0.75x;SCALE: 1/4\" = 1'-0\"}"

Too bad you already did these manually, this code seems to cleanup the mess.

(defun c:foo (/ o s)
  (if (setq s (ssget '((0 . "MTEXT") (1 . "*ELECTRICAL PARTIAL*"))))
    (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
      (vla-put-textstring
	(setq o (vlax-ename->vla-object e))
	(vl-string-subst
	  "ELECTRICAL PLAN PARTIAL"
	  "FIRST FLOOR ELECTRICAL PARTIAL"
	  (vla-get-textstring o)
	)
      )
    )
  )
  (princ)
)

2021-10-20_12-58-37.gif

0 Likes
Message 9 of 9

nrz13
Advisor
Advisor

I reported this bug to Autodesk and this was their response:

Thank you again for your patience and the input you provided about this MTEXT editing issue issue with AutoCAD. The Product Team has been able to reproduce the issue and it has been logged with the development team for a fix in a future update. The reference ID is ACD-24756. Although the team is investigating a solution for a fix in a future update, I cannot commit to an exact date as conditions do change.


Work:  AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-8700K, 32GB RAM, Samsung 960 Pro SSD, AMD Radeon Pro WX 5100, 3 Dell Monitors (3840x2160)
Home: AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-11700, 64GB RAM, Samsung 980 Pro SSD, NVIDIA Quadro P2200, Dell Monitor (3840x2160)