I could not find any info on touch sense tolerance checking, if the TCP is out or the wire is bent, the code below worked good for me.
this is a simple touch sensing check that would allow you to call a different job if a particular tolerance has been exceeded. When you do a search, a VCDx variable is declared in the data list associated with the src file. An attribute of this variable is the OFFSET value that gets calculated every time you do a search. This is the correction data that shifts the program positions when you do a CORR on instruction. You can set up some simple logic that uses this variable to check if the value is within a specified tolerance:
IF ((VCD1.OFFSET > 2.5) OR (VCD1.OFFSET < -2.5)) OR ((VCD2.OFFSET > 2.5) OR (VCD2.OFFSET < -2.5)) THEN
HALT
ENDIF
This is the logic I used for a 2 dimensional search (X and Y). You could use similar logic for a 3 dimensional search routine by adding the VCD3.OFFSET check logic. Instead of halting, you could insert a job call to your TCP check job. I have attached the sample program.