Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mtext Font Conversion

6 REPLIES 6
Reply
Message 1 of 7
paul.ashley
494 Views, 6 Replies

Mtext Font Conversion

Is there a programming method in 2008 to grab all text within all Mtext objects across all layouts and change the font?

Changing the font of the text style doesn't do the trick, even though nearly all of our Mtext items do not use fonts ather than that of the Style.

I need to do this in batch suing ScriptPro.
6 REPLIES 6
Message 2 of 7
Ajo1
in reply to: paul.ashley

I have seen free lisps out there (other than express tools version) that will convert standard text back to Mtext. So, my thought is that you might write the program to select all desired mtext objects, while storing their mtext box extents for each in a list bound to a variable (I'll call it MEXTENTS).

Then, convert the lines of plain text to whatever you want, and finally, have the program select the various groups of text using the coordinates from MEXTENTS , then reconverting those groups back to mtext using the mtext conversion code as a subroutine.

A few steps, but it should get the job done. You could run something like that in a script.
Message 3 of 7
EC-CAD
in reply to: paul.ashley

Here is a way to do that.

;; Change MText Font / Style
;; Control Systems & Services, Inc.

(command "-style" "NEWSTYLE" "FTLTLT.TTF" "2" "1" "0" "N" "N")
;; edit above for your target font, height, width factor, oblique angle..

(defun C:CHGMTEXT ( / ss )
(setq ss (ssget "X" (list (cons 0 "MTEXT"))))
(if ss
(progn
(setq C 0)
(repeat (sslength ss)
(setq entx (ssname ss C))
(setq ent (entget entx))
(setq ent (subst (cons 7 "NEWSTYLE")(assoc 7 ent) ent))
(entmod ent)
(setq C (+ C 1))
); repeat
); progn
); if
(princ)
); function

;; Uncomment for Batch mode
;;; (C:chgmtext)

(princ); silent load

Bob
Message 4 of 7
paul.ashley
in reply to: paul.ashley

I gave this a try but it appears to change the font of the mtext object itself but not of the text within it. That's the wierd part about mtext, you can have text inside mapped to a style but then change its font.
Message 5 of 7
paul.ashley
in reply to: paul.ashley

I just found this routine referenced in another thread on this subject:

StripMtext.lsp on http://cadabyss.wordpress.com/

It says it can be run in a script and will have to give it a try.
Message 6 of 7
EC-CAD
in reply to: paul.ashley

I put together an MText object in R2008, changed (some) of
the fonts .. I see what you mean.
I guess you would have to 'force' the formatting code(s), for
each portion of the string.. to be what 'style' you want.
(e.g. force it to be something like)
"\fCourier New|CE|b0|i0|c238|p49;\\OLD STRING\\NEXT STRING
ect.
Short of totally rebuilding the MText (entmake) .. I guess I
wouldn't know how to do that.....

Bob
Message 7 of 7
cadman777
in reply to: paul.ashley

"StripMtext" did exactly what I wanted to correct Autocad's deep-seated text-formatting problems I had when converting Inventor idw's to Autocad dwg's. Thanks a lot for the link!

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost