@Sea-Haven wrote:
.... The biggest problem is taking the mtext and convert to a decimal number, in the mtext there is like 4 variations in what is used, inches only, inch & fractions, fractions only, different text but with suffixes and again a mix of inches and fractions. Working on that.
That's mostly not an issue, because the (distof) function can work with all of those possibilities except the suffixes. It can handle it whether or not there is a fraction involved, whether or not [as some might do] you use a hyphen between inches and fractions, whether or not you include the inches mark at the end, and if the distances get big enough to include feet. Even if the content is already a decimal number, with or without the inches mark, it can work with that, returning it as a decimal. Assuming no other internal Mtext formatting [like font or color or height overrides] to complicate things, these all convert to good decimal equivalents for sorting:
Command: (distof "2 1/2\"") with fraction and inches mark, without hyphen
2.5
Command: (distof "2-1/2\"") with fraction and inches mark, including hyphen
2.5
Command: (distof "2-1/2") with fraction and hyphen but no inches mark
2.5
Command: (distof "2") no fraction, no inches mark
2.0
Command: (distof "2\"") no fraction, with inches mark
2.0
Command: (distof "2'-2 3/4\"") including feet
26.75
Command: (distof "2.5\"") already decimal, with inches mark
2.5
But the suffix spoils it, so something would need to be done to pare it down to just the distance content.
Command: (distof "2-1/2\" S.B.")
nil
Kent Cooper, AIA