[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Convert Text to Mtext Without Changing Justification
Tip# 4309 By Kent Cooper On 17-May-2014
Rated By 0 users Downloaded : 2011
Categories : Single-Line Text, Multiline Text
Software type : AutoCAD 2015
Rename File To : Text1MtextJust2.lsp
Change single text entities into mtext and preserve the original text’s justification.

Editor's Note: In September 2014, this tip was updated and the LISP file was replaced with a new version. The tip author describes the updates as follows:

Someone at the AutoDesk Customization Forum asked for the T1MJ command in Text1MtextJust.lsp to be able to do the same with Attribute-Definition objects in addition to Text objects, as AutoCAD’s TXT2MTXT command does, so I worked that in. I also changed the Undo begin/end part of it, to not use (command) functions for that, so it will work in AutoCAD 2015 which no longer allows (command) function in error handlers.

Kent Cooper points out that a conversion of bottom-center-justified AutoCAD text into mtext using the built-in Txt2Mtxt command comes out as top-center-justified mtext, rather than bottom-center, which would be like the original text. The Txt2Mtxt command, though it preserves the horizontal component (left/center/right) of the original text’s justification, consistently imposes the Top vertical component, regardless of the original text’s vertical component (top/middle/bottom). That may make some sense when multiple text entities are being combined into mtext, but not when a single one is merely being converted (for example, so that you can get fractions stacked or change something like the color of a portion of it, etc.).

That inspired the routine here, which will change single text entities into mtext and preserve the original text’s justification (or equivalent, for text justifications that are not used with mtext). See comments at the top of the file.



Average Rating:

User comments