-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPROBEYSLOT
More file actions
executable file
·115 lines (93 loc) · 3.8 KB
/
PROBEYSLOT
File metadata and controls
executable file
·115 lines (93 loc) · 3.8 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
//Copyright 2024 Toolpath Labs Inc., Justin Gray, and Josh Smith
//PROBEYSLOT
//Description: Probe a web in X from left to right
//Initial Coding: Justin Gray
//Modified 1/14/2024: Joshua Smith
//Simplified WCS extended number math, added probe error checking, added probe inspection report
//#1 is the work coordinate system to store offsets in
//#2 is the expected width of the web in the Y direction
//#9 print results enabled by fusion360
//#17 turns on inspection report on/off: 0 leaves it off default; 1 turns it on
//#18 oversize tolorance
//#19 enable oversize check
//load probe config
G65 "PROBECONFIG"
M20 // UNLOCK SPINDLE ORIENT
M19 P270 // ORIENT SPINDLE 270 DEGREES TO KEEP THE POBING POINT THE SAME
//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
#121 = @101 //TOOL DIAMETER PROVIDED BY PROBECONFIG MACRO
#122 = @106 //WEB PROBE DISTANCE PROVIDED BY PROBECONFIG MACRO
#108 = @108 //PROBE BACKOFF DISTANCE PROVIDED BY PROBECONFIG MACRO
#2 = ABS[#2]
//CALCULATE EXTENDED WCS NUMBER
//FIX is a round down function and MOD is modulo
#114 = ROUND[[#1 - FIX[#1]] * 10]
//probe Y starting from a negative offset and probing in the positive direction
//MOVE TO -Y SIDE OF THE PART, BEFORE STARTING TO PROBE
G31 G91 P2 Y-[#2/2+#122] 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
G91 G01 Y[#108] //back off
FIX_CUT_OR_ON
G31 G91 P2 Y[-#108] F#112 //FEED UNTIL SKIP SLOW
FIX_CUT_OR_OFF
#104=R_SKIP[0,202] //GET FIRST MACHINE Y COORDINATE
G91 G01 Y[#108] //back off
M20 // UNLOCK SPINDLE ORIENT
M19 P90 // ORIENT SPINDLE 90 DEGREES TO KEEP THE POBING POINT THE SAME
//move to the opposite side of the part
G31 G91 P2 Y[#2+#122-#108] F#111 //move to other side of the part,pobe distance away
//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
G91 G01 Y[-#108] //back off
FIX_CUT_OR_ON
G31 G91 P2 Y[#108] F#112 //FEED UNTIL SKIP SLOW
FIX_CUT_OR_OFF
#105=R_SKIP[0,202] //GET SECOND MACHINE Y COORDINATE
G91 G01 Y[-#108] F#110 //back off
//COMPUTE RELATIVE DISTANCE TO CENTER OF THE PART
#106 = [[#105-#104]/2] //calculate center
#107 = ABS[#105-#104]+#121 //calculate distance: distance - diameter
@999 = #107 //save distance to a global variable for use with other macros
G91 G01 Y[-#106 + #108] //MOVE TO CENTER OF THE PART
#104=R_MACH_COOR[0,2] //GET MACHINE Y COORDINATE
#126=ABS[#107-#2] //expected stock error
//if the tolorance is null, default it to global variable from the probe config
IF[#18==#0]
#18 = @110
END_IF
//oversized stock alarm if stock error is greater than tolorance
IF[#19!=#0 && #126>#18 ]
ALARM["ERROR: STOCK OUTSIDE OF TOLORANCE IN Y"]
END_IF
//safety check for inspection variable
IF[#9 == #0]
#9 = 0
END_IF
//STORE Y OFFSET
IF [#1 < 53 || #1 == #0 || #9 > 0]
//DO NOT WRITE ANYTHING TO WCS
ELSEIF [#114 < 1]
W_G53G59_COOR[0,#1,2,#104]
ELSE
W_G54EXP_COOR[0,#114,2,#104]
END_IF
//simple inspection reporting
IF[#17>0]
MENU_ADD["Part Width: #107",""];
MENU["INSPECTION REPORT","RESULTS","",1];
END_IF
N1
M20 // UNLOCK SPINDLE ORIENTATION FOR SAFETY
G90
M99