hexagon logo

incorrect output

I have a problem when printing the correct value. The output should be dependent on which of the deviation of Z value is greater, and that one, must be displayed. In my code I always get the last of the "CASE" command line.
LOC2.Z.DEV = 0.0344
LOC4.Z.DEV = 0.0064
MAXINDEX give me the right result (number 1) and according to result MAXINDEX I should get the value for output LOC2.Z.MEAS = 8.4656. But in my case I always get the last value in CASE statements, that is 8.4936, which belongs measurement LOC4 instead of LOC2.

Please if you can, help me identify where the problem is.
Here is the code:

DIM LOC2= LOCATION OF CIRCLE CIR6 UNITS=MM ,$
GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH
AX MEAS NOMINAL DEV +TOL -TOL OUTTOL
X 0.0632 0.0000 0.0632 0.1500 -0.1500 0.0000 -----#--
Z -8.4656 -8.5000 0.0344 0.1000 -0.1000 0.0000 -----#--
D 8.2821 8.3000 -0.0179 0.1500 -0.1500 0.0000 ---#----
END OF DIMENSION LOC2

DIM LOC4= LOCATION OF CIRCLE CIR4 UNITS=MM ,$
GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH
AX MEAS NOMINAL DEV +TOL -TOL OUTTOL
X 0.0418 0.0000 0.0418 0.1500 -0.1500 0.0000 -----#--
Z -8.4936 -8.5000 0.0064 0.1000 -0.1000 0.0000 ----#---
D 8.3074 8.3000 0.0074 0.1500 -0.1500 0.0000 ----#---
END OF DIMENSION LOC4

ASSIGN/MT = GETCOMMAND("DIMENSION LOCATION","UP",2)
ASSIGN/MTS = STR(MT)
ASSIGN/MERE_Z[1] = ABS(LOC2.Z.DEV)
ASSIGN/MERE_Z[2] = ABS(LOC4.Z.DEV)
ASSIGN/I ZBOR = MAXINDEX(MERE_Z) <--- give me result (1)
SELECT/ IZBOR
CASE/1
ASSIGN/ MERAMAX_Z = ABS(LOC2.Z.MEAS) <--- this should be print out
END_CASE/
CASE/2
ASSIGN/ MERAMAX_Z = ABS(LOC4.Z.MEAS) <--- I always get the second result in print report
END_CASE/
END_SELECT/
ASSIGN/IME_DEL2 = MTS + "LOC4_MERAMAX_Z.TXT"
ASSIGN/IME_CEL = IME_DEL1 + "_" + IME_DEL2
OBSTAJA =FILE/EXISTS,IME_CEL
IF/OBSTAJA==0
FPTR =FILE/OPEN,IME_CEL,WRITE
FILE/WRITELINE,FPTR,"ZAPIS_ST.: ," + ZAPIS + "," + "DATUM: "+ SYSTEMDATE("dd'/'MM'/'yy") + " CAS: "+ SYSTEMTIME("hh':'mm") +","+ IME_CEL
FILE/WRITELINE,FPTR,"Vrsta Meritve,Os, Nominalna Mera,Zg.Toleranca,Sp.Toleranca,Izmerjeno,Odstopanj e"
FILE/CLOSE,FPTR,KEEP
END_IF/
FPTR =FILE/OPEN,IME_CEL,APPEND
ASSIGN/VPIS = MERAMMAX_Z
FILE/WRITELINE,FPTR,STEVEC + "," + ",Z,," + ABS(MTS.Z.NOM) + "," + MTS.Z.PTOL + "," + MTS.Z.MTOL + "," + MERAMAX_Z + "," + MTS.Z.OUTTOL

I have the same problem when I using If/EndIf - Else/EndElse statements.

Thank you in advance
Parents Reply Children
No Data