@Sea-Haven wrote:
... realised no need to copy....
....
(command "copy" ent "" pt1 pt2)
(command "explode" (entlast))
(setq ss (ssget (list (cons 0 "TEXT"))))
....
But if someone should attempt a routine, big questions for @john.uhden :
What about justification in Mtext? If you don't Copy it, and do the work with the Exploded original, then though you may convert back to Mtext later, you need to go into SEttings to not word-wrap, so justification won't always be Top-Left [although in quick trial sometimes it seems to revert to that, anyway], and so line breaks won't end up in different places [if line lengths are unequal enough caused by internal hard returns]. And it seems Line Space Style always ends up as "At least," which could shift things a little if the original was "Exactly." So I think the better approach would be to Copy it to leave the original and preserve other justification and line breaks, and work with the Exploded copy.
Then there's the question of internal formatting. Exploding seems to leave some of that, breaking up the original into separate Text pieces at each change. Color and size and width factor seem to be preserved, but font changes can affect more than in the original, and tracking or obliquing are not preserved [obliquing survives EXPLODEing, but not TXT2MTXT-ing back], which can lead to incorrect results. [Not that I have any idea how to account for those....]
If Exploding is to be part of the process [whether of the original or a copy], the pieces resulting from that become the Previous selection, so there's no need to have User selection involved in (ssget)-ing them:
....
(command "explode" {whether the original or the copy})
(setq ss (ssget "P"))
....
Kent Cooper, AIA