-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZzeroATC.sbp
More file actions
173 lines (141 loc) · 7.09 KB
/
ZzeroATC.sbp
File metadata and controls
173 lines (141 loc) · 7.09 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
' The following licensing information must accompany this file at all times.
' ********** Licensing Information ******************************************************
' Copyright 2001 ShopBot Tools
' We encourage ShopBot users to modify this part file to suit their own needs and have licensed it
' under the Creative Commons Atribution 3.0 license. This license allows you to copy, distribute,
' or modify the file with certain restrictions. Any other use requires permission from ShopBot Tools.
'
' A simplified explanantion of this license is available at
' http://creativecommons.org/licenses/by/3.0/us/
'
' and the full legal code can be found at
' http://creativecommons.org/licenses/by/3.0/us/legalcode
' We encourage you to read this legal code before modifying or distributing this file,
' ESPECIALLY sections 5 and 6 that cover warranties and liability.
'
' If you plan on distributing your new version, you must also state in the header of your file that it
' is a modification of a file supplied by Shopbot Tools, supply information on finding the original file,
' and rename the file to make it clear to the user that it is a modified version.
' ********** End Licensing Information **************************************************
'
'****************************************************************************************
'ZZEROATC.SBP -- Specialized Example File showing how to Zero Z ATC on Contact Plate
'Copyright 1998-2008. ShopBot Tools, Inc.
'----------------------------------------------------------------------------------------
'*NOTE* This file will always be over-written during software update installations to insure
' it is kept standard and current.
'*NOTE* If you want to make a custom version of this file that is called with the C2 Command
' you should save it with a different name, say "ZZERO_Joes_8_23_08.sbp", then change the
' C2 Command (found in C:\SbParts\Custom\Custom2.sbc to call your file rather than the
' standard file. The Custom files are NOT over-written during software upgrades, so this
' way your modification will be permanent, at least until you change it.
'----------------------------------------------------------------------------------------
'** Table Base Coordinates NOT Zeroed During This ATC Version of Routine
'Variables in this file are read from the my_variables.sbc file in c:\Sbparts\Custom
'Most recent update by ShopBot 12/11; now uses system SafeZ for pull-up (set in [VC])
'8/20/13 Added speed downshift for XY so that packets would be small and allow a STOP on plunge if hit
'**TEST YOUR PLATE BY TAPPING IT AGAINST BIT --> SWITCH INDICATOR SHOULD ACTIVE ON SCREEN
'Initialize
SA, 'Let's be in Absolute Mode
SF,0 'Turn off limit checking temporarily here
'Determine whether we are in Preview mode or Move/Cut mode
&modenow = %(22)
IF &modenow = 1 THEN GOTO CHANGEMODE
'Confirm Spindles OFF
SO, 1, 0
SO, 2, 0
'Load variables from my_variables.sbc, process called by Custom Cut 90
C#,90
'Make sure that the units are those used with the Set-Up Program and expected by my_variables.sbc
&SCALE = 1
IF &my_units <> %(25) THEN GOSUB CHANGEUNITS
'Set thickness and pull-up distance
&zbot = &my_ZzeroThickness * (1+24.4*%(25))
&zup = %(28)
If &zup < &zbot Then &zup = &Zbot + (.125 * (1+24.4*%(25)))
If %(3) < &zup Then MZ, &zup
'Set a value for our first Z move
&big_plunge = %(3) - 36 * (1+24.4*%(25))
'Check to see if we should move to a zeroing location
IF &my_ZzeroStartX <> no THEN GOSUB STARTMOVE
'Save current speeds and set zeroing speed
&start_Zmove_Speed = %(73)
&start_XYmove_Speed = %(71)
&new_Zmove_Speed = .25 * (1+24.4*%(25))
&new_XYmove_Speed = .25 * (1+24.4*%(25))
'----------------------------------------------------------------Zeroing PROGRAM
FIRST PLUNGE:
'Make First Plunge... the following line will display first and wait for key stroke
' *** Hit ENTER When above plate and Ready to Zero ***
PAUSE
GOSUB TEST_CLEAR 'Test to make sure the plate is not already contacting or probe hooked up
'Now set-up the contact switch action ...
ON INP(&my_ZzeroInput,1) GOTO CONTACT1 'this is where we'll go on contact with plate
VS, &new_XYmove_Speed, (&new_Zmove_Speed * 2 )
MZ, &big_plunge 'Start continuous plunge ... while looking for contact to occur
'If we don't contact anything for some reason we end up here
ON INP(&my_ZzeroInput,1) 'Turn off switch check
VS, &start_XYmove_Speed, &start_Zmove_Speed 'Reset Speeds because zeroing failed
'Zeroing Failed!
PAUSE
END 'This END statement causes the program to end here if not contact
SECOND PLUNGE:
'Make a Second Slower Plunge to get it really accurate
GOSUB TEST_CLEAR 'Check for clear again
'Set-up the second contact switch action ...
ON INP(&my_ZzeroInput,1) GoTo CONTACT2 'this is where we'll go on contact with plate
VS, , &new_Zmove_Speed
&little_plunge = %(3) - 2
IF %(25) = 1 THEN &little_plunge = %(3) - 50.8
MZ, &little_plunge 'Start continuous plunge ... looking for second contact to occur
'If we don't contact anything for some reason we end up here
ON INP(&my_ZzeroInput,1) 'Turn off switch check
VS, &start_XYmove_Speed, &start_Zmove_Speed 'Reset Speeds because zeroing failed
'Zeroing Failed!
PAUSE
END 'This END statement causes the program to end here if no contact
'================================================================Subroutines
CONTACT1:
'This is our subroutine for action on hitting the plate the first time
VA,,,&zbot 'Set the approximate Z location based on thickness
PAUSE 1
JZ, &zup 'Pull-up SLIGHTLY ...
'Now We're Ready to Make Slow Move for Accurate Reading
PAUSE 1
GOTO SECOND PLUNGE
CONTACT2:
'This is our subroutine for action on hitting the plate the second time
VA,,,&zbot '',,,,,0 'Set final Z location and NOT Zero Table Base Coordinate (commented out)
PAUSE 1
VS, &start_XYmove_Speed, &start_Zmove_Speed
JZ, &zup 'Pull-up to safe height
'***ZEROED! REMEMBER TO REMOVE ALLEGATOR CLIP, AND PUT AWAY PLATE!***
PAUSE
END
TEST_CLEAR:
&cleared = &my_ZzeroInput + 50
IF %(&cleared) = 1 THEN PAUSE 3
IF %(&cleared) = 1 THEN GOTO NO_CLEAR
RETURN
NO_CLEAR:
'Reset the orginal Z speed
VS, &start_XYmove_Speed, &start_Zmove_Speed
'Z-Contact did not clear for some reason. Exiting.
PAUSE
END
CHANGEUNITS:
'You are using a different Unit System (inches/millimeters) than you used with the Set-Up Tool. Changing the routine to match your current units.
PAUSE
IF %(25) = 1 THEN &SCALE = 25.4
IF %(25) = 0 THEN &SCALE = 0.03937
RETURN
STARTMOVE:
'Hit OK to move to your preferred starting point to start the routine.
PAUSE
IF %(3) < &zup THEN JZ, &zup
J2, &my_ZzeroStartX, &my_ZzeroStartY
RETURN
CHANGEMODE:
'Tool won't home in Preview Mode. Quit and change Move/Cut mode ...
PAUSE
END 'Exit program Now