forked from cncjs/CNCjs-Macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiameterIndependent_Beaver_wireBk
108 lines (82 loc) · 2.7 KB
/
diameterIndependent_Beaver_wireBk
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
;Start with end mill above the probe, near corner of the workpiece
;This macro works best with 3 axis probe blocks that the connecting wire is on the BACK
;Wait until the planner queue is empty
%wait
;Set user-defined variables
%Z_PROBE_THICKNESS = 22 ;thickness of Z probe plate
%X_PROBE_THICKNESS = 7 ;thickness of X probe plate
%Y_PROBE_THICKNESS = 7 ;thickness of Y probe plate
%PROBE_DISTANCE = 50 ;Max distance for a probe motion
%PROBE_FEEDRATE_A = 150
%PROBE_FEEDRATE_B = 50
%TRAVEL_FEEDRATE = 500 ;Feed for travel moves (rapids might be too rapid)
%Y_PROBE_DIM = 50 ;length of probe Y
%X_PROBE_DIM = 50 ;width of probe X
%XY_PROBE_DEPTH = 5 ;depth below probe block surface to probe X & Y
%UNITS=modal.units
%DISTANCE=modal.distance
G91 ; Relative positioning
G21 ;Use millimeters
;Probe Z
G38.2 Z[-PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 Z2 ;retract 2mm
G38.2 Z-5 F[PROBE_FEEDRATE_B] ;Slow Probe
; A dwell time of half second to make sure the planner queue is empty
G4 P0.25
;Set Z0
G10 L20 Z[Z_PROBE_THICKNESS]
; A dwell time of half second to make sure the planner queue is empty
G4 P0.25
;Move to X loc
G0 Z10
G1 X[X_PROBE_DIM] F[TRAVEL_FEEDRATE]
G0 Z-[10+XY_PROBE_DEPTH]
;Probe toward right side (X pos)
G38.2 X[-PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 X2 ;retract 2mm
G38.2 X-5 F[PROBE_FEEDRATE_B] ;Slow Probe
%X_TOP = posx
G4 P0.05 (X TOP = [X_TOP])
;Move to other X
G1 X10 F[TRAVEL_FEEDRATE]
G0 Z[10+XY_PROBE_DEPTH]
G1 X-[X_PROBE_DIM + 35]
G0 Z-[10+XY_PROBE_DEPTH]
;Probe toward left side (X neg)
G38.2 X[PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 X-2 ;retract 2mm
G38.2 X5 F[PROBE_FEEDRATE_B] ;Slow Probe
%X_BOTTOM = posx
; A dwell time of half second to make sure the planner queue is empty
G4 P0.5 (X BOTTOM = [X_BOTTOM])
;Calculate radius of endmill
%ENDMILL_RADIUS = (X_TOP-X_BOTTOM-X_PROBE_DIM)/2
G4 P0.1 (Radius = [ENDMILL_RADIUS])
;Set X0
G10 L20 X[0-ENDMILL_RADIUS-X_PROBE_THICKNESS]
; A dwell time of half second to make sure the planner queue is empty
G4 P0.25
;Move to Y probe area
G1 X-10 F[TRAVEL_FEEDRATE]
G0 Z[10+XY_PROBE_DEPTH]
G1 X30 Y-[Y_PROBE_DIM]
G0 Z-[10+XY_PROBE_DEPTH]
;Probe Y
G38.2 Y[PROBE_DISTANCE] F[PROBE_FEEDRATE_A]
G0 Y-2 ;retract 2mm
G38.2 Y5 F[PROBE_FEEDRATE_B] ;Slow Probe
; A dwell time of half second to make sure the planner queue is empty
G4 P0.25
;Set Y0
G10 L20 Y[0-ENDMILL_RADIUS-Y_PROBE_THICKNESS]
; A dwell time of half second to make sure the planner queue is empty
G4 P0.25
;Move to Final loc
G1 Y-10 F[TRAVEL_FEEDRATE]
G0 Z[10+XY_PROBE_DEPTH]
G90 ;absolute distance
G1 X0 Y0
%TOOL_DIAMETER = ENDMILL_RADIUS*2
; A dwell time of half second to make sure the planner queue is empty
G4 P0.5 (Tool Diameter = [TOOL_DIAMETER])
[UNITS] [DISTANCE] ;restore unit and distance modal state