Mr. Bond (James I presume):
Having been inspired by @pbejse, I decided to make one that finds all the decimal pieces inside mtexts and convert them from apparent feet to architectural feet and inches.
(defun wcsearch (str match / pos n1 n2 found)
(setq pos 1 n2 1)
(while (and (not n1)(not found)(<= pos (strlen str)))
(if (wcmatch (substr str pos)(strcat match "*"))
(progn
(setq n1 pos)
(while (not (wcmatch (substr str n1 n2) match))
(setq n2 (1+ n2))
)
(setq found (substr str n1 n2))
)
(setq pos (1+ pos))
)
)
found
)
(defun c:demo2 ( / matches ss i ent old found new)
(setq matches '("#.##" "##.##" "###.##" "####.##"))
(if (setq ss (ssget "_:L" '((0 . "MTEXT,TEXT") (1 . "*#.##*"))))
(repeat (setq i (sslength ss))
(setq ent (entget (ssname ss (setq i (1- i)))))
(setq old (cdr (assoc 1 ent)) new old)
(while (setq found (car (vl-remove nil (mapcar (function (lambda (x)(wcsearch new x))) matches))))
(setq new (vl-string-subst (rtos (* 12 (distof found)) 4 3) found new))
)
(if (/= old new)(entmod (subst (cons 1 new)(assoc 1 ent) ent)))
)
)
)
NOTES:
The wcsearch function is not built to use wildcards other than #
You can change the matches variable as you see fit for your conditions
Be careful of your setting for DIMZIN. Mine was 0.
For example, it turned this:
THE ELEVATIONS AT THE FOLLOWING POINTS ARE:
"A" = 22.43
"B" = 8.75
"C" = 133.69
into this:
THE ELEVATIONS AT THE FOLLOWING POINTS ARE:
"A" = 22'-5 1/8"
"B" = 8'-9"
"C" = 133'-8 1/4"