Minimize Problem
We want to print a dimension string with rounded digits in style of German DIN 1356.

Minimize Solution
There are two solutions for different ArchiCADs and with different effort. The older one is the correct one. The newer is easier to handle in GDL. This older script was rewritten for common use for a question in the German GDL forum.

Minimize Script - ArchiCAD 8.0
var=1.2345 ! Example value for output

! Define styles and alignments
pos=9 ! Text style Ancor / alignment
posZ=INT((pos-1)/3)+1  ! Ancor row (1-3)
posS=pos-(posZ-1)*3    ! Ancor column (1-3)

fontH=2.5
DEFINE STYLE "dim_base" "Arial",fontH,pos,0
DEFINE STYLE "dim_expo" "Arial",
fontH*0.7,(posZ-1)*3+1,0

! Factor to find end of dimension base string (0, 0.5, 1)
pos=1-(posS-1)/2

! Request format settings
format = ""
dimension="LINEAR_DIMENSION"
sts = REQUEST (dimension, "",format)

! transfer value to string
var_base = str{2}(format,var,var_expo)

! output base
SET STYLE "
dim_base"
text2 0,0,
var_base

! Calculate base string dimension
baseW=STW(var_base)*GLOB_SCALE/1000
baseH=
fontH*GLOB_SCALE/1000*0.5

! output exponent
SET STYLE "
dim_expo"
text2
pos*baseW,baseH,var_expo

Minimize Script - ArchiCAD 9.0+
var=1.2345 ! Example value for output

! Request format settings
format = ""
dimension="LINEAR_DIMENSION"
sts = REQUEST (dimension, "",format)

! Check, if last digit is rounded
pos=STRSTR(format,"*")
IF pos THEN
  sts=SPLIT(STRSUB(format,pos+1,1),"%n",formR)
  formR=2-INT(FRA(formR/2)+0.5)
  ! Replace with corresponding rounding info *5 or *6
  format=STRSUB(format,1,pos-1) \
        +"*"+STR(4+formR,1,0) \
        +STRSUB(format, pos+2,255)
  ! Increase number of digits by 1 or 2
  pos=STRSTR(format,".")
  IF pos THEN
    sts=SPLIT(STRSUB(format,pos+1,1),"%n",digit)
    format=STRSUB(format,1,pos) \
          +STR(digit+formR,1,0) \
          +STRSUB(format, pos+2,255)
    ENDIF
  ENDIF

! output
varS = str{2}(format,var)

text2 0,0,varS