PDA

View Full Version : Text to MText Conversion



michael.viall919828
2013-04-12, 02:10 PM
I am working on an old project that was dormant for a few years and came back. I am looking to convert of of the text to mtext (I am fine with selecting a text box, hitting select similar) and using the express tools command txt2mtxt to convert, but when I do that the style is different. Our standard width factor for mtext is .9, but when I convert the existing text to mtext it has a width factor of 1 even though in style it is set to .9. Does anyone have any suggestions or a routine that would change the width factor throughout the page to .9 with having to individually click in each mtext block, highlight the text and manually change the width factor? Any help would be greatly appreciated, thanks in advance!

fixo
2013-04-13, 03:42 PM
Not sure about if this will be works for you
I've used mtext formatting method to change:

(defun C:MXW (/ MtextChangeFactor mx pfx sfx sset widfac)

;;helper

(defun MtextChangeFactor (ename fac / elist)
(setq elist (entget ename) pfx "{\\W" sfx "}")
(setq elist (subst
(cons 1 (strcat pfx (rtos fac)";" (cdr (assoc 1 elist)) sfx))
(assoc 1 elist) elist))
(entmod elist)
(entupd ename)
)

;; main part

(prompt "\nSelect Mtext to change width factor")
(if (and (setq sset (ssget (list (cons 0 "MTEXT");|(cons 8 "MyMTEXTLayer1,MyMTEXTLayer2,MyMTEXTLayerETC")|;)));;<- uncomment layer filter if you need
(or (initget 6)
(setq widFac (getreal "\nEnter width factor: "))))
(progn
(while (setq mx (ssname sset 0))
(MtextChangeFactor mx widFac)
(ssdel mx sset)
)
)
)
(princ)
)
(prompt "\n\t---\tStart command with MXW\t ---")
(prin1)

michael.viall919828
2013-04-22, 05:05 PM
Thank for the code! Definitely a time saver. The only strange this is after the width factor changes there is a " "; " at the beginning of the text string.

nod684
2013-05-07, 04:39 AM
have you tried LeeMac's routine here?
http://www.lee-mac.com/text2mtext.html