forked from cncjs/CNCjs-Macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hole_Center
57 lines (47 loc) · 1.48 KB
/
Hole_Center
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
;Start with probe in hole, BELOW Z surface
; Wait until the planner queue is empty
%wait
; Set user-defined variables
%PROBE_DISTANCE = 20
%PROBE_FEEDRATE_A = 150
%PROBE_FEEDRATE_B = 50
%PROBE_MAJOR_RETRACT = 5 ;distance of retract before probing opposite side
%UNITS=modal.units
%DISTANCE=modal.distance
G91 ; Relative positioning
G21 ;Use millimeters
; Probe toward right side of hole with a maximum probe distance
G38.2 X[PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 X-2 ;retract 2mm
G38.2 X5 F[PROBE_FEEDRATE_B] ;Slow Probe
%X_RIGHT = posx
G0 X-[PROBE_MAJOR_RETRACT] ;retract
; Probe toward Left side of hole with a maximum probe distance
G38.2 X-[PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 X2 ;retract 2mm
G38.2 X-5 F[PROBE_FEEDRATE_B] ;Slow Probe
%X_LEFT = posx
%X_CHORD = X_RIGHT - X_LEFT
G0 X[X_CHORD/2]
%X_CENTER = posx
; A dwell time of one second to make sure the planner queue is empty
G4 P1
G10L20X0
; Probe toward top side of hole with a maximum probe distance
G38.2 Y[PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 Y-2 ;retract 2mm
G38.2 Y5 F[PROBE_FEEDRATE_B] ;Slow Probe
%Y_TOP = [posy]
G0 Y-[PROBE_MAJOR_RETRACT] ;retract
; Probe toward bottom side of hole with a maximum probe distance
G38.2 Y-[PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 Y2 ;retract 2mm
G38.2 Y-5 F[PROBE_FEEDRATE_B] ;Slow Probe
%Y_BTM = posy
%Y_CHORD = Y_TOP - Y_BTM
G0 Y[Y_CHORD/2]
%Y_CENTER = posy
; A dwell time of one second to make sure the planner queue is empty
G4 P1
G10L20Y0
[UNITS] [DISTANCE] ;restore unit and distance modal state