hello let's discuss a bit this common code used to send the turret at index postion :
rapid @ X > soft_limit Z... ( M203 M09 Txy00 etc )
... broken vector occurs, leading to unnecesary movement across Z
soft_limit is not a round value, being particular to the cnc
CAM is usually customized to hit a round value above the soft_limit
also IGF default values behave in the same way
solutions :
1) rapid @ X=common_variable Z... Txy00 ( M203 M09 etc )
... initialize a common_variable with the soft_limit value, and don't use it for anything else
2) rapid @ X+VPVLX-VBZOX Z... Txy00 ( M203 M09 etc )
... this code is general, and does not need a common variable
... avoids the need to declare and secure a common_variable on each lathe
... avoids the need to edit the common_variable each time the cnc is aligned
3) rapid @ X=local_variable Z... Txy00 ( M203 M09 etc )
... put this somewhere near the begin of the program : local_variable = VPVLX - VBZOX
...... avoids the need to calculate the soft_limit each time a retreat movement occurs
4) rapid @ X=local_variable-VETFX Z...-VETFZ ( M203 M09 etc )
... this code eliminates the need to cancel the tool
of course, nobody cares about a bit of unnecesary movement if it works, is great ...
the solutions shared are nothing on their own ; just a piece of a puzzle
don't worry, codes had been tested
Code:LVXP = VPVLX - VBZOX V1 = 0 ( * ) G00 X+LVXP-VETFX Z150-VETFZ M203 CALL OCAN Q12 M02 ( . . . . . . . . . . . . . . . . . . . . . . . . ) OCAN V1 = V1 + 1 T = V1 * 10101 X200 Z100 X+LVXP-VETFX Z150-VETFZ M203 CALL OWRT RTS ( . . . . . . . . . . . . . . . . . . . . . . . . ) OWRT FWRITC t.txt;A PUT VSIOX PUT ' ' PUT VSIOZ PUT ' ' PUT VETFX PUT ' ' PUT VETFZ PUT ' ' PUT VAPAX PUT ' ' PUT VAPAZ WRITE C CLOSE C RTS