Call this function passing a array of robtargets as param. You can use any number of points.
It will return the the lowest X element.
MODULE EvalRobtarget
CONST robtarget p10:=[[600,200,300],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget p20:=[[200,200,300],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget p30:=[[300,200,300],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget p40:=[[400,200,300],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget p50:=[[500,200,300],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
PROC main()
VAR robtarget lowestXPoint;
lowestXPoint:=EvalLowestX([p10,p20,p30,p40,p50]);
TPWrite "Lowest X: "\Pos:=lowestXPoint.trans;
ENDPROC
FUNC robtarget EvalLowestX(robtarget points{*})
VAR num numberOfElements;
VAR num lowestIndex:=1;
numberOfElements:=Dim(points,1);
FOR index FROM 1 TO numberOfElements DO
IF points{index}.trans.x < points{lowestIndex}.trans.x lowestIndex:=index;
ENDFOR
RETURN points{lowestIndex};
ENDFUNC
ENDMODULE
Display More