Text to Mtext justified middle center

Hi,

There are quite a few lisp routines floating around which convert text to mtext, and I've experimented with a lot of these. When I need to convert text to mtext, I usually also have to make the justification of the mtext object middle center. All the routines I've used make the justification of the mtext top left. Additionally, the Expresstools TXT2MTXT routine changes the rotation to 90 degrees, even if the original text object(s) were at a different rotation.

Does anyone have a lisp routine which can do both (convert text to mtext AND change the justification of the resultant mtext object middle center) without having to run two different commands and which retains the original rotation of the text?

Any help or guidance on how to modify an existing program would be greatly appreciated.

Comments

  • Anthony Apostolaros
    edited October 2019

    I have a function that does that, though it moves the mtext a little bit away from where the base dtext was.

    I got most of the code from someone else a long time ago; I'm not sure who.
    My notes say DotSoft, but I don't see it on DotSoft's website or in the zip file I downloaded from them.
    The only thing I added was the justification, just before the end of the main function.

    I can't get it into a code block in this post, so I've attached it as a file.

  • Thanks Anthony, I'll test it tomorrow.

  • By the way, if you have another lisp-based text-to-mtext custom command that you like better, you can insert the justification part of the code at the end of that instead. That's the 6 lines of code between sssetfirst and selgrips. In fact, I probably added those two lines also. If you don't want the new mtext selected and highlighted, you can delete those two lines or put a semicolon in front of each one.

  • Hi Anthony,

    I've had a chance to test your code, and it works very well. Thank you for your help.