-
Notifications
You must be signed in to change notification settings - Fork 4
/
M6Start.m1s
89 lines (56 loc) · 2.39 KB
/
M6Start.m1s
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
'M6 Tool Change Script
'Created: C. Stewart [email protected] 24/02/2018
'25/02/2018 - Change to absolute co-ords for Z
'03/06/2018 - Turn off coolant call, added turn off Z limt for tools with long len.
'TODO read if CNC has been zeroed in session'
Dim ZsafeABS, XcoordToolChangeABS, YcoordToolChangeABS, Ret, FeedRateJog, ZfeedRateRetract, ZfeedRatePlunge As Integer
Dim selectedToolNum As Integer
Dim selectedToolDesc As String
Dim selectedToolCompleteDesc As String
ZfeedRatePlunge = 100
ZfeedRateRetract = 1000
FeedRateJog = 2000
XcoordToolChangeABS = 45
YcoordToolChangeABS= 300
ZsafeABS = 0 'Changed to abs
selectedToolNum = GetSelectedTool()
selectedToolDesc = GetToolDesc(selectedToolNum)
selectedToolCompleteDesc = "T:" & selectedToolNum & " - " & selectedToolDesc
selectedToolHeight = GetToolParam(selectedToolNum, 2)
'Retract to safe ZsafeABS - Machine coords
Code "G53 Z" & ZsafeABS & "F"& ZfeedRateRetract
'Move to tool change location - Machine coords'
Code "G53 X" & XcoordToolChangeABS & " Y" & YcoordToolChangeABS & "F"& FeedRateJog
' Check tool lenght (if greater than 60 - turn off Z++ limit)
If selectedToolHeight >= 60 Then
ret = MachMsg("Tool selected is too long for vaccum extraction, please remove vacuum shoe and press OK."& Chr(10) & "Click 'NO' to abort!" & Chr(10) & "Click 'CANCEL' to skip", "REMOVE VACCUM SHOE", 3)
If ret = 6 Then
'Turn off Z++ limit
SetOEMDRO(834,0)
Message( "Z++ limit deactivated")
ElseIf ret = 2 Then
Message( "Vaccum removal skipped" )
End
ElseIf ret = 7 Then
Message( "Abort" )
DoOemButton(1021)
End If
Else
SetOEMDRO(834,1)
End If
'ret = MsgBox("Please insert tool number " & selectedToolCompleteDesc & " Once the tool has been changed, hit 'Yes' - Warning! 'No' will abort!", 68, "Has Tool been Changed?")
ret = MachMsg("Please insert tool number " & selectedToolCompleteDesc & Chr(10) & "Once the tool has been changed, click 'Yes'" & Chr(10) & "Click 'NO' to abort!" & Chr(10) & "Click 'CANCEL' to skip", "CHANGE THE TOOL", 3)
If ret = 6 Then
SetCurrentTool(GetSelectedTool())
Message( "Tool changed to: " & selectedToolCompleteDesc)
ElseIf ret = 2 Then
Message( "Tool NOT changed - skipped" )
'Code "M8"
End
ElseIf ret = 7 Then
Message( "Tool NOT changed" )
DoOemButton(1021)
End If
'TODO - rezero
Code "M200"
'Code "M8"