Custom GCode to offset tool height on Tool Change

Post technical questions about the Buildbotic Controller here.
Forum rules
No profanity, no gambling, no illegal activity, so sexual or pornographic material.

Posts not related to the Buildbotic CNC Controller are likely to be moved or deleted.
Post Reply
Chris
Posts: 9
Joined: Sat Dec 08, 2018 8:03 am

Custom GCode to offset tool height on Tool Change

Post by Chris » Sun Apr 05, 2020 7:04 am

Hi all - managed to get my 8x4 handmade CNC working over the past few weeks and decided I wanted to have a probe switch to help offset the z height on tool changes, here's a few pictures of the setup and the GCode I'm using - seems to be working so far but any improvements/tweaks are always welcomed:

Tool-Change Code:
G91 G0 Z8 (shift to safe height)
G21 G40 G49
G17
G90
G53 G0 X550 Y24.5 F600 (move to probe switch position)
M5
M0(MSG, Click 'Continue' when the spindle has stopped)
G38.2 Z-90 F100 (probe current tool)
#5000=#<_z> (set variable #5000 to current z height that triggered switch)
G53 G0 X550 Y24.5 Z0.0 F300 (move to safe height to change the tool)
M0(MSG, Change tool)
G38.2 Z-90 F100 (probe new tool)
#4999=#<_z> (set variable #4999 to new z height that triggered switch
G0 Z0 F300 (move to old Z0)
G92 Z[#5000-#4999] (set new Z0 to offset difference in tool height)
Attachments
toolchange.jpeg
2ndtool.jpeg
toolchange.jpeg
2ndtool.jpeg
1sttool.jpeg

User avatar
Doug
Posts: 343
Joined: Fri Feb 02, 2018 4:56 pm

Re: Custom GCode to offset tool height on Tool Change

Post by Doug » Tue Apr 07, 2020 3:12 pm

Nice work. My only suggestion would be to insert an M70 at the beginning of the program to save the machine state and M72 at the end of the program to restore the original state after the probing sequence is completed.

Chris
Posts: 9
Joined: Sat Dec 08, 2018 8:03 am

Re: Custom GCode to offset tool height on Tool Change

Post by Chris » Wed Apr 08, 2020 12:14 am

Thanks Doug - will add that in

Post Reply