ok so i think i figured this out, however it doesnt work for me like it did you
Command: (addmetric "2 5/8\" O.D. x 1 5/16\" I.D.")
"2 5/8\" (67mm) O.D. x 1 5/16\" I.D."
here is the code i have
;; conversion code by irneb from theswamp.org
(defun RX:Search (string pattern / lst col item)
;(if (RX:Start)
;(progn
(vlax-Put *RX-Link* 'Pattern pattern) ;Set the pattern to match
;; Get the collection of match objects
(setq col (vl-catch-all-apply 'vlax-Invoke (list *RX-Link* 'Execute string)))
(if (not (vl-catch-all-error-p col))
(progn
;; Loop through collection & place into return list
(vlax-for item col
;; Get the position & length
(setq lst (cons (cons (vlax-Get item 'FirstIndex) (vlax-Get item 'Value)) lst))
(vlax-release-object item) ;Release the match object
) ;_ end of while
(vlax-release-object col) ;Release the collection object
) ;_ end of progn
) ;_ end of if
(reverse lst) ;Return list in correct order
;) ;_ end of progn
;) ;_ end of if
) ;_ end of defun
(defun ExtractImperial (str / len n m c res)
(setq n 0 len (strlen str) res "")
(while (and (not (wcmatch res "*#',*#\"")) (< n len))
(while (and (<= (setq n (1+ n)) len) (not (wcmatch (substr str n 1) "[0-9]"))))
(setq m 0)
(while (and (<= (+ n (setq m (1+ m))) (1+ len)) (not (wcmatch (substr str n m) "*[~-'0-9/\" ]*"))))
(setq res (vl-string-trim " /-" (substr str n (1- m))) n (+ n m)))
(if (wcmatch res "*#',*#\"") res "")
)
(defun AddMetric (str /)
(foreach val (reverse
(RX:Search str "((\\d+'[ -]\\d \\d+/\\d+\")|(\\d+'[ -]\\d\")|(\\d+')|(\\d+ \\d+/\\d+\")|(\\d+/\\d+\")|(\\d+\"))"))
(setq str (vl-string-subst (strcat (cdr val) " (" (rtos (cvunit (distof (cdr val) 4) "inch" "mm") 2 0) "mm)") (cdr val) str (car val)))) str)
; code from me
(DEFUN C:test ()
;
;; GET ENTITY
;
(SETQ MT (ENTSEL "\nPLEASE PICK DESIRED TEXT"))
(SETQ MTED (ENTGET (CAR MT)))
(SETQ MTLL (ASSOC '1 MTED))
(SETQ MTT (CDR MTLL))
(setq MTT (addmetric MTT))
(SETQ TLN (CONS 1 MTT))
(SETQ TLNN (SUBST TLN MTLL MTED))
(ENTMOD TLNN)
(PRINC)
)