-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPROBEXYANGLE
More file actions
executable file
·187 lines (146 loc) · 5.53 KB
/
PROBEXYANGLE
File metadata and controls
executable file
·187 lines (146 loc) · 5.53 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// Copyright 2024 Toolpath Labs Inc., Justin Gray, and Josh Smith
// PROBEXWEB
// Description: Probe and report an angle measured in the XY plane
// Initial Coding: Joshua Smith
// #1 is the work coordinate system to store offsets in
// #2 is the distance between probing points
// #3 is the probing distance
// #4 is the probing axis 1=X, 2=Y
// #17 turns on inspection report on/off: 0 leaves it off ; 1 turns it on ; it is off by default
// load probe config
G65 "PROBECONFIG"
M19 // ORIENT SPINDLE
// important local variables
#100 = @100 // TOOL NUMBER PROVIDED BY PROBECONFIG MACRO
#110 = @103 // FEED SPEED PROVIDED BY PROBECONFIG MACRO
#111 = @104 // FAST PROBE SPEED PROVIDED BY PROBECONFIG MACRO
#112 = @105 // SLOW PROBE SPEED PROVIDED BY PROBECONFIG MACRO
#108 = @108 // PROBE BACKOFF DISTANCE PROVIDED BY PROBECONFIG MACRO
#109 = R_MACH_COOR[0,1] // GET MACHINE X COORDINATE
#110 = R_MACH_COOR[0,2] // GET MACHINE y COORDINATE
#111 = R_MACH_COOR[0,3] // GET MACHINE z COORDINATE
// CALCULATE EXTENDED WCS NUMBER
// FIX removes any decimal value
#114 = ROUND[[#1 - FIX[#1]] * 10]
IF[#4== 1]
// Probe X the desired distance and at fast feed
G31 G91 P2 X[#3] F#111
// Error Checking
IF[R_SKIP[0,1] == 0]
ALARM["ERROR: FAILED TO PROBE PART WITHIN SPECIFIED DISTANCE"]
GOTO1 // go to line with N1 and quit
END_IF
// Start probing in X
G91 G01 X-[#108] // back off 1/4 the probing distance
FIX_CUT_OR_ON
G31 G91 P2 X[#108] F#112 // Probe X the desired distance at slow feed
FIX_CUT_OR_OFF
#120 = R_SKIP[0,201] // GET MACHINE X COORDINATE
#121 = R_SKIP[0,202] // GET MACHINE Y COORDINATE
#122 = R_SKIP[0,202] // GET MACHINE Y COORDINATE
G91 G01 X-[#108] // back off 1/4 the probing distance
// move to original X position
G31 G91 P2 X[-#109+#120+#108] F#111
// Error Checking
IF[R_SKIP[0,1] == 1]
ALARM["ERROR: PREMATURE PROBE COLLISION"]
GOTO1 // go to line with N1 and quit
END_IF
// Move disired probe distance
G31 G91 P2 Y[#2] F#111
// Error Checking
IF[R_SKIP[0,1] == 1]
ALARM["ERROR: PREMATURE PROBE COLLISION"]
GOTO1 // go to line with N1 and quit
END_IF
// Probe X the desired distance and at fast feed
G31 G91 P2 X[#3] F#111
// Error Checking
IF[R_SKIP[0,1] == 0]
ALARM["ERROR: FAILED TO PROBE PART WITHIN SPECIFIED DISTANCE"]
GOTO1 // go to line with N1 and quit
END_IF
// Start probing in X
G91 G01 X-[#108] // back off 1/4 the probing distance
FIX_CUT_OR_ON
G31 G91 P2 X[#108] F#112 // Probe X the desired distance at slow feed
FIX_CUT_OR_OFF
#123 = R_SKIP[0,201] // GET MACHINE X COORDINATE
#124 = R_SKIP[0,202] // GET MACHINE Y COORDINATE
#125 = R_SKIP[0,202] // GET MACHINE Y COORDINATE
G91 G01 X-[#108] // back off 1/4 the probing distance
// move to original X position
G31 G91 P2 X[-#109+#123+#108] F#111
// Error Checking
IF[R_SKIP[0,1] == 1]
ALARM["ERROR: PREMATURE PROBE COLLISION"]
GOTO1 // go to line with N1 and quit
END_IF
// angle claculation
#126 = ATAN[[#123-#120],[#124-#121]]
ELSE
// Probe Y the desired distance and at fast feed
G31 G91 P2 Y[#3] F#111
// Error Checking
IF[R_SKIP[0,1] == 0]
ALARM["ERROR: FAILED TO PROBE PART WITHIN SPECIFIED DISTANCE"]
GOTO1 // go to line with N1 and quit
END_IF
// Start probing in Y
G91 G01 Y-[#108] // back off 1/4 the probing distance
FIX_CUT_OR_ON
G31 G91 P2 Y[#108] F#112 // Probe X the desired distance at slow feed
FIX_CUT_OR_OFF
#120 = R_SKIP[0,201] // GET MACHINE X COORDINATE
#121 = R_SKIP[0,202] // GET MACHINE Y COORDINATE
#122 = R_SKIP[0,202] // GET MACHINE Z COORDINATE
G91 G01 Y-[#108] // back off 1/4 the probing distance
// move to original Y position
G31 G91 P2 Y[-#110+#121+#108] F#111
// Error Checking
IF[R_SKIP[0,1] == 1]
ALARM["ERROR: PREMATURE PROBE COLLISION"]
GOTO1 // go to line with N1 and quit
END_IF
// Move disired probe distance
G31 G91 P2 X[#2] F#111
// Error Checking
IF[R_SKIP[0,1] == 1]
ALARM["ERROR: PREMATURE PROBE COLLISION"]
GOTO1 // go to line with N1 and quit
END_IF
// Probe Y the desired distance and at fast feed
G31 G91 P2 Y[#3] F#111
// Error Checking
IF[R_SKIP[0,1] == 0]
ALARM["ERROR: FAILED TO PROBE PART WITHIN SPECIFIED DISTANCE"]
GOTO1 // go to line with N1 and quit
END_IF
// Start probing in Y
G91 G01 Y-[#108] // back off 1/4 the probing distance
FIX_CUT_OR_ON
G31 G91 P2 Y[#108] F#112 // Probe X the desired distance at slow feed
FIX_CUT_OR_OFF
#123 = R_SKIP[0,201] // GET MACHINE X COORDINATE
#124 = R_SKIP[0,202] // GET MACHINE Y COORDINATE
#125 = R_SKIP[0,202] // GET MACHINE Z COORDINATE
G91 G01 Y-[#108] // back off 1/4 the probing distance
// move to original X position
G31 G91 P2 Y[-#110+#124+#108] F#111
// Error Checking
IF[R_SKIP[0,1] == 1]
ALARM["ERROR: PREMATURE PROBE COLLISION"]
GOTO1 // go to line with N1 and quit
END_IF
// angle claculation
#126 = ATAN[[#124-#121],[#123-#120]]
END_IF
// simple inspection reporting
IF[#17>0]
MENU_ADD["MEASURED ANGLE: #126",""];
MENU["INSPECTION REPORT","RESULTS","",1];
END_IF
N1
M20 // UNLOCK SPINDLE ORIENTATION FOR SAFETY
G90
M99