-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPROBEXSLOT
More file actions
executable file
·114 lines (92 loc) · 3.71 KB
/
PROBEXSLOT
File metadata and controls
executable file
·114 lines (92 loc) · 3.71 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
//Copyright 2024 Toolpath Labs Inc., Justin Gray, and Josh Smith
//PROBEXSLOT
//Description: Probe a SLOT 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 length of the web in the x 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 P180 // ORIENT SPINDLE 180 DEGREES TO KEEP THE POBING POINT THE SAME
//important local variables
#100 = @100 //TOOL NUMBER 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 removes any decimal value
#114 = ROUND[[#1 - FIX[#1]] * 10]
//probe X starting from a negative offset and probing in the positive direction
//MOVE TO -X SIDE OF THE PART, BEFORE STARTING TO PROBE
G31 G91 P2 X-[#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 X[#108] //Back OFF
FIX_CUT_OR_ON
G31 G91 P2 X-[#108] F#112 //FEED UNTIL SKIP SLOW
FIX_CUT_OR_OFF
#104=R_SKIP[0,201] //GET FIRST MACHINE X COORDINATE
G91 G01 X[#108] //Back off
M20 // UNLOCK SPINDLE ORIENT
M19 P0 // ORIENT SPINDLE 0 DEGREES TO KEEP THE POBING POINT THE SAME
//Move to opposite side of part
G31 G91 P2 X[#2+#122-#108] F#111 //move to other side of the part, probe 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 X[-#108] //BACK OFF
FIX_CUT_OR_ON
G31 G91 P2 X[#108] F#112 //FEED UNTIL SKIP SLOW
FIX_CUT_OR_OFF
#105=R_SKIP[0,201] //GET SECOND MACHINE X COORDINATE
G91 G01 X[-#108] //BACK OFF
//COMPUTE RELATIVE DISTANCE TO CENTER OF THE PART
#106=[[#105-#104]/2] //center point calculation
#107= ABS[[#105-#104]]+#121 //calculate width of part: distance + diameter
@998 = #107 //save distance to a global variable for use with other macros
G91 G01 X[-#106 + #108] //MOVE TO CENTER OF THE PART
#104=R_MACH_COOR[0,1] //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 X"]
END_IF
//safety check for inspection variable
IF[#9 == #0]
#9 = 0
END_IF
//STORE X OFFSET
IF [#1 < 53 || #1 == #0 || #9 > 0]
//DO NOT WRITE ANYTHING TO WCS
ELSEIF [#114 < 1]
W_G53G59_COOR[0,#1,1,#104]
ELSE
W_G54EXP_COOR[0,#114,1,#104]
END_IF
//simple inspection reporting
IF[#17>0]
MENU_ADD["Part Length: #107",""];
MENU["INSPECTION REPORT","RESULTS","",1];
END_IF
N1
M20 // UNLOCK SPINDLE ORIENTATION FOR SAFETY
G90
M99