So big upgrade to this code with a huge shout out to @Cryptonym he re-wrote my very basic code to include subroutines. Really streamlined everything, top notch work Warren! So this version will measure both tools at the first tool change, each subsequent change will only need to measure the new tool. Also, it will carry the tool # forward to the correct dialogue box. Also, I added a move towards the middle of the machine for the actual changing of the bit, little easier than working way off in the corner. This version will not cause problems with the laser.
So this has been tested with the Onefinity PP for Vectric. THIS HAS ONLY BEEN TESTED WITH METRIC FILES AND CONTROLLER IN METRIC. There is likely some changes needed to use imperial. I’m not sure how other PP’s or software will work with this code. Firmware 1.0.8. I suspect that all the 1F PP’s will be similar so should work for them. IF your gcode has an M06 command for the FIRST tool there is some modifications that can be made to avoid the first probe sequence that would be unnecessary.
In the program-start dialogue box under settings in the flyout menu copy and paste the following:
(Runs at program start)
G90 (Absolute distance mode)
G17 (Select XY plane)
#5000=-999
o10 sub
G53 G0 Z-10
G53 G0 X780 Y50
o15 if [[#5000] EQ -999]
M0 (msg, Remove Dust Boot, Attach Magnet, Click “Continue”…)
o15 else
G53 G0 X600
M0 (debug, Remove Dust Boot, Insert Tool #<_selected_tool>, Attach Magnet, Click “Continue”…)
G53 G0 X780
o15 endif
G92.2
G53 G0 Z-70
G38.2 Z-133 F100
G0 Z[#<_Z>+1] F100
G38.2 Z-133 F25
o10 endsub
In the tool-change dialogue in the settings copy and paste the following:
(Runs on M6, tool-change)
M70
S0 M5
G21 G40 G49 G17 G90
o20 if [[#5000] EQ -999]
o10 call
#5000 = #<_Z>
G53 G0 Z-10
G92.3
o20 endif
o10 call
#4999= #<_Z>
G92.3
G0 Z25.4
G92 Z[#5000-#4999+25.4]
G53 G0 Z-10
#5000 = #4999
M0(MSG,Remove Probe, Install Dust Boot, Click “Continue”…)
G0 X0 Y0
M72