/
qt_auto_probe_tool.ngc
90 lines (70 loc) · 2.37 KB
/
qt_auto_probe_tool.ngc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
o<qt_auto_probe_tool> sub
;(debug, in change tool_in_spindle=#<tool_in_spindle> current_pocket=#<current_pocket>)
;(debug, selected_tool=#<selected_tool> selected_pocket=#<selected_pocket>)
#<tool> = #<selected_tool>
#<pocket> = #<selected_pocket>
; we must execute this only in the milltask interpreter
; or preview will break, so test for '#<_task>' which is 1 for
; the milltask interpreter and 0 in the UI's
O100 if [#<_task> EQ 0]
(debug, Task ist Null)
O100 return [999]
O100 endif
; adjust back off distance if metric/imperial based machine
O150 if [#<_metric_machine>]
O175 if [#<_imperial>]
(MSG, Auto Tool probe error: not in G21 mode )
O175 return [-3] ; indicate probe contact failure to epilog
O175 endif
#<backoff> = 4.0
O150 else
O175 if [#<_imperial> EQ 0]
(MSG, Auto Tool probe error: not in G20 mode )
O175 return [-3] ; indicate probe contact failure to epilog
O175 endif
#<backoff> = 0.200
O150 endif
;first go up
F #<_hal[qtversaprobe.searchvel]>
G53 G1 Z[#<_ini[CHANGE_POSITION]Z>]
; then move to change position
G53 G0 X[#<_ini[CHANGE_POSITION]X>] Y[#<_ini[CHANGE_POSITION]Y>]
; cancel tool offset
G49
; using the code being remapped here means 'use builtin behaviour'
M6
O200 if [#<_hal[qtversaprobe.enable]> EQ 0]
(MSG, Auto Tool probe disabled )
O200 return [3] ; indicate no tool measurement
O200 endif
G53 G0 X[#<_ini[VERSA_TOOLSETTER]X>] Y[#<_ini[VERSA_TOOLSETTER]Y>]
F #<_hal[qtversaprobe.searchvel]>
G53 G1 Z[#<_ini[VERSA_TOOLSETTER]Z>]
O300 if [#<_hal[qtversaprobe.searchvel]> LE 0]
O300 return [-1] ; indicate searchvel <= 0
O300 endif
O400 if [#<_hal[qtversaprobe.probevel]> LE 0]
O400 return [-2] ; indicate probevel <= 0
O400 endif
F #<_hal[qtversaprobe.searchvel]>
G91
G38.2 Z #<_ini[VERSA_TOOLSETTER]MAXPROBE>
G0 Z2
;reprobe at probe speed
F #<_hal[qtversaprobe.probevel]>
G38.2 Z-#<backoff>
O500 if [#5070 EQ 0]
G90
O500 return [-3] ; indicate probe contact failure to epilog
O500 endif
G90
G53 G0 Z[#<_ini[CHANGE_POSITION]Z>]
#<touch_result> = #5063
(DEBUG, %fProbe Height: #<_hal[qtversaprobe.probeheight]>)
(DEBUG, %fBlock Height: #<_hal[qtversaprobe.blockheight]>)
(DEBUG, %fProbe Result: #<touch_result>)
G10 L1 P#<tool> Z[#<touch_result> - #<_hal[qtversaprobe.probeheight]> + #<_hal[qtversaprobe.blockheight]>]
G43
; signal success be returning a value > 0:
o<qt_auto_probe_tool> endsub [1]
m2