!»» Example with automatic scale string of drawing stamps
scaleS=AC_DrawingScale
!»» CONVERT SCALE-STRING TO NUMERIC
scaleN=0
!»» Cut of "M" at the beginning. Not needed.
s=STRSTR(scaleS,"M")
IF s THEN scaleS=STRSUB(scaleS,s+1,STRLEN(scaleS)-s)
!»» Imperial or metric?
s=STRSTR(scaleS,"=")
!»» Converting ...
IF s THEN
!»» Scale notation is imperial
sts=SPLIT(STRSUB(scaleS,1,s-1),"%n",lengthR)
sts=SPLIT(STRSUB(scaleS,s+1,STRLEN(scaleS)-s),"%n",lengthP)
IF lengthR THEN scaleN=lengthP/lengthR ELSE scaleN=MAX(lengthP,0)
ELSE
!»» Scale notation is metric
s=STRSTR((scaleS,":")
IF s THEN
sts=SPLIT(STRSUB(scaleS,1,s-1),"%n",lengthR)
sts=SPLIT(STRSUB(scaleS,s+1,STRLEN(scaleS)-s),"%n",lengthP)
IF lengthR THEN scaleN=lengthP/lengthR ELSE scaleN=MAX(lengthP,0)
ELSE
sts=SPLIT(scaleS,"%n",scaleN)
ENDIF
ENDIF
!»» scaleN contains the divisor of the scale.
!»» PRINT RESULTS
TEXT2 0,0,"»"+scaleS+"« - »"+STR("%^.3",scaleN)+"«"