When calling the RAPID TO TOOLCHANGE command, I want to have the code output two different options depending on whether or not it is the same tool coming back in, or a new tool.
If the next tool is different from the current tool, I need the machine to travel to the G28 home position to update the offsets.
However, in many cases we use this command to move the tool away from the part and stop the program for an insert change or to measure the part.
In these cases, the same tool is coming back in again and we do not want to move all the way to the home position.
The code below shows the additional logic (in red) that I think will handle this, but unfortunately I do not know the correct Edgecam syntax.
Can anyone tell me what the Code Wizard format should be.




;CODE: @ZFIRST
[DELETE][BLKNUM][RAPIDGCODE][ZMOVE][<C>COOLANT OFF]
[DELETE][BLKNUM][RAPIDGCODE][XMOVE]
IF NEXTTOOL = current tool %GOTO @END
;CODE: %GOTO @ALWAYS

;CODE: @DEFAULT
[DELETE][BLKNUM][RAPIDGCODE][XMOVE][ZMOVE][<C>COOLANT OFF]
IF NEXTTOOL = current tool %GOTO @END
;CODE: %GOTO @ALWAYS

;CODE: @ALWAYS
[DELETE][BLKNUM] M5
[DELETE][BLKNUM] G28 U0 W0
[DELETE][BLKNUM] M0

;CODE: @END