@apelbaum2014 wrote:
In my case any arabic numeric text always consist of only characters representing an integer, but sometimes I have an exceptions..
For the only-integer-string cases, one way would be something like [in very basic terms, and untested]:
(defun C:Int2Roman (/ txt txtdata txtstr)
(setq
txt (car (entsel "\nSelect Text/Mtext representation of integer number to convert to Roman numeral: "))
txtdata (entget txt)
txtstr (cdr (assoc 1 txtdata))
); setq
(entmod
(subst
(cons 1 (ALE_Int->Roman (atoi txtstr))); put new value in place of:
(assoc 1 txtdata); old value, in:
txtdata; entity data list
); subst
); entmod
); defun
That further assumes that if it's Mtext, it has no internal formatting [font, color, italics or other assignments], but only the plain numerical-character text content.
For the occasional exceptions: There are threads on this Forum about changing the numerical portion of a string that may also contain other non-numerical characters. Some are about incrementing or stepping the number value [increasing or decreasing it from what it currently is], and some are about assigning a replacement value that may be unrelated to the current value [a stepping value decided by the routine], but there may be other operations. A Search will probably find something that you can use, substituting the (ALE_Int->Roman) function in place of whatever is used to set the new numerical text portion.
Kent Cooper, AIA