Tool changes And Z Height

Ok, its been a busy couple of weeks and I hadnt had much time to tinker on this project until today. I finally got it all working. Any advice is welcome. I just realized that the program start code wants to run at the beginning of all macros too so I need to figure how to separate the initial bit-setting code from the rest of it so it doesnt try to do that for every macro.

Thank you @Aiph5u for all of your help.

To hook up the RCATC dust cover to the OF Controller I enabled Load2 - hi-lo via the I/O menu and wired it via the breakout connector since I already was using that connector for my Spindle modbus control. I used ground and pin 1 for the two wires to complete a ground circuit that goes to an ATTiny85 which controls a stepper motor driver. This should work great and keep any voltage from the stepper motor driver isolated from the OF Controller. I am using M08 to open the dust cover at the beginning of the tool change and M09 to close the dust cover when the tool change is complete.

The code below still has lots of safety checks in it since this is all new so I can ensure this is all working properly before removing any of the debug points.

Here is the code that I am using for the Program Start:

#548=1 ; current tool, default to 1
#549=95 ; touch Probe Y
#550=31.262 ; first pocket X
#551=207.453 ; first pocket Y
#552=-110; lift height
#553=-133; plunge height
#554=-40; move height
#555=1800; spindle speed

O1000 sub; disengage tool subprogram
#548=#<_selected_tool> - 1
#15=(45.0*#548) + #551; selected pocket Y placeholder
M0 (DEBUG, Moving to pocket #548 at Y#15 to remove tool #548, please remove the dust boot and place the touch plate in the bit setting area. Click "Continue" if you are ready.)	
M4S#555 ; turn spindle to reverse

G53 G0 X#550 Y#15; move to selected pocket
G4 P5; pause for 5 sec
G53 G0 Z#553; plunge
G53 G0 Z#552; lift
G53 G0 Z#553; plunge
G53 G0 Z#554; lift to move
M5; stop spindle M5
M0 (DEBUG, Attempted to remove tool #548. Please check to verify and ensure tool #<_selected_tool> is loaded in magazine.  Then please place the touch plate in the bit setting area. Click "Continue" if you are ready.)	
O2000 call ; run tool engage sub program 2000
O1000 endsub;

O2000 sub; engage tool
M3S#555; turn spindle to forward
#15=45.0 + #551; selected pocket Y placeholder
G53 G0 X#550 Y#15; move to selected pocket
G4 P5; pause for 10 sec
G53 G0 Z#553; plunge
G53 G0 Z#552; lift
G53 G0 Z#553; plunge
G53 G0 Z#554; lift to move
M5; stop spindle M5
M0 (DEBUG, Tool #<_selected_tool> engaged successfully. Click "Continue" if you're ready to set new tool height offset.)
O2000 endsub;

M70; Save modal states
M5; Stop the spindle
G21; Set metric units mode
G40; Turn cutter compensation off
G49; Cancel Tool Length Compensation
G17; Select XY plane
G90; Set absolute distance mode
G53 G0 Z-10; Lift Z rapidly to Z=-10 mm in absolute machine coordinates - manual tool change position
G53 G0 X#550 Y#549; Go rapidly to bit setter area in absolute machine coordinates - manual tool probe position
M0 (MSG, Please connect the touch plate to the controller, place the touch plate in the bit setting area. Click "Continue" if you are ready.)	
G0 Z-10; Go rapidly to a position 10 mm above currently active workpiece Z zero
G92.2; Turn off G92 offsets but keep parameters 5211 - 5219 available.
F100; Set feedrate to 100 mm/min for probing. (which means slow)
G38.2 Z-133; Move the milling motor downwards until the bit touches the touch plate
#5000=#<_Z>; Set the user parameter 5000 to the current Z position value
G53 G0 Z-10; Lift Z to rapidly to Z=-10 mm in absolute machine coordinates - manual tool change position
;M0 (MSG, Please remove the magnet end from the collet, remove the touch plate, attach the dust boot and start the router. Click ā€œContinueā€ if you are ready.)

G92.3; G92.3 - Restore the G92 offset to the values previously saved in parameters 5211 to 5219
G0 X0 Y0; Rapidly move to your workpiece X and Y origin
M72	; Restore modal states
G90	; Set absolute distance mode
G17	; Select XY plane

Here is the code that I am using for the Tool Change section:

M70; Save modal states
M08
S0; Set spindle speed to 0
G21; Set metric units mode
G40; Turn cutter compensation off
G49; Cancel Tool Length Compensation
G17; Select XY plane
G90; Set absolute distance mode
G53 G0 Z-10; Go rapidly to Z=-10 mm in absolute machine coordinates - manual tool change position
O1000 call; run disengage subprogram 1000
G53 G0 Z0; lift to 10mm above working height
G53 G0 X#550 Y#549; Go rapidly to touch probe area in absolute machine coordinates - manual tool change position
G0 Z-10
G92.2; Turn off G92 offsets but keep parameters 5211 - 5219 available.
F100; Set feedrate to 100 mm/min for probing. (which means slow)
G38.2 Z-133; Move the milling motor downwards until the bit touches the touch plate
#4999=#<_Z>; Set the user parameter 4999 to the current Z position value
G92.3; G92.3 - Restore the G92 offset to the values previously saved in parameters 5211 to 5219
G0 Z25.4	; Go rapidly to a 25.4 mm above currently active workpiece Z zero
G92 Z[#5000-#4999+25.4]; Compute the new Z offset by subtracting new tool length offset from old tool length offset and make this the new tool length offset
G53 G0 Z-10; Lift Z rapidly to Z=-10 mm in absolute machine coordinates - manual tool change position
#5000=#4999; Set user parameter 5000 to the value in user parameter 4999
; M0 (MSG, Please remove the magnet end from the collet, remove the touch plate, attach the dust boot. Click "Continue" if you are ready.)	
M09
G0 X0 Y0; Rapidly move to your workpiece X and Y origin
M72	; Restore modal states

Hello Aiph5u! Thank you for posting. This was a huge help!

First time post but I hope this is useful.

For everyone who recently purchased a machine the new probing block from Onefinity (at least mine) is 15mm!!! Or measured at 0.590", validated on two different calipers so it’s 14.986mm.

When using my Onefinity Journeyman Pro I kept changing the probing block height to match my specific dimension but didn’t know I needed to update the G92 Z##.# dimension in the ā€œon tool changeā€ section as well. Of course my Z height was wrong and cut into my spoilboard giving me an offset of 0.015" or about 0.4mm as expected (now that I know why).

After updating my code to the following it solved my problem. I know this may seem obvious but not to me until after reading the aiph5u update above.

Old Code
G92 Z15.4

New Code:
G92 Z14.986 ; Set this position as the new Z zero value (to reflect new tool length - including subtraction of the touch plate’s height which is 15.4 mm thick)

For everyone who has this issue be sure to update this detail in the tool change to the dimensions of your probing block.

2 Likes

Hello, I’m struggling even after reading through the tool change gcode that u recommend
I’m working in imperial, so the gcode that you advise is all in mm.
Does that mean I need to change the distances to imperial.
I tried to do exactly what you had given and my Z axis only drops down an inch or so after the tool change and is no where close to Top of the work piece. It will not allow for jogging..ur probably sick of dumb questions, but I really am reading a trying my best?