[ craft "x" parts from a bar ]
... put the bar inside, don't clamp the chuck
... call a "sensless gauging" program:
...... counter from main program is reset
...... turret comes in front of the chuck at a specific distance
...... pull the bar on the turret / tool + close the chuck
...... auto Z occurs
...... check if detected Z is within a "safe range" ( not too close to chuck / not too far from the chuck)
...... straight face at Z0.3
...... if face is not clean, repeat the program without unclamping the material
......... thus, the "safe range" should allow repeating the program a few times, being sure that nothing happens when tools go closer to the chuck
... call a program that initializes a common variable with a value that represents the number of parts
...... i like to call this type of programs as presseters, because they preset the number of loops inside the main program
...... i may have 2,3, etc such programs, depending on the length of the material / bar
... call the main program, that cuts the frontal at Z0
...... this program will repeat as many times as it was told by the previous program
this does not require the operator to edit variables inside the parameters page