I wouldn't place it in pretract, as it is called up at the end of the tool in use .... not in between ops that use the same tool
I'd consider a separate postblock, so it can be easily corrected and also placed independently
ie
Code:
ptoolbrkchk # tool breakage check
if MI5$>0, [
sav_spc = spaces$
spaces$ = 1
absinc$ = zero
gcode$ = zero
pbld, n$, "G53 Z0.", e$
pbld, n$, "G65 P9023 A24.", *t$, "H.01 (CHECK FOR BROKEN TOOL)", e$
spaces$ = sav_spc
]
Placement could be at the top of "peof$" & at top of "ptlchg$"
- so for a single tool, peof$ would look at MiscInt #5
- for multiple tools, the ptlchg$ would look for the setting, last tool would look when the peof$ is executed
Code:
peof$ #End of file for non-zero tool
ptoolbrkchk
pretract
comment$
#absinc$ = zero
#pbld, n$, *sgcode, *sgabsinc, protretinc, e$
if stagetool = 1 & stagetltype = 2, pbld, n$, *first_tool$, e$
n$, "M30", e$
mergesub$
clearsub$
mergeaux$
clearaux$
"%", e$
Code:
ptlchg$ #Tool change
ptoolbrkchk
pcuttype
toolchng = one
if mi1$ = one, #Work coordinate system
[
pfbld, n$, *sg28ref, "X0.", "Y0.", e$
pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
]
if prog_stop = 1, pbld, n$, *sm01, e$
if prog_stop = 2, pbld, n$, *sm00, e$
"()", e$
Now.... you need to set your default MiscInt#5 =0, so that it doesn't do a tool check after each operation, & set it to =1 only for the operation you want checked.......
....... we have not placed ptoolbrkchk in ptlchg0$, so if that tool is used in a following op...... it may not gauge check, ptoolbrkchk may also need to be placed in this postblock (ptlchg0$)
happy proving off