# Tool changes And Z Height

**URL:** <https://forum.onefinitycnc.com/t/tool-changes-and-z-height/7715>\
**Category:** Original/PRO Series (Buildbotics) (Gen 1)\
**Created:** [September 14, 2021, 4:10pm UTC](https://forum.onefinitycnc.com/t/tool-changes-and-z-height/7715 "2021-09-14T16:10:13Z")\
**Posts on this page:** 1\
**Showing post:** 29

<div class="post-metadata">

**Author:** ![349iq2345](https://avatars.discourse-cdn.com/v4/letter/3/bb73d2/32.png) [@349iq2345](https://forum.onefinitycnc.com/u/349iq2345)\
**Post date:** [March 14, 2023, 5:13am UTC](https://forum.onefinitycnc.com/t/tool-changes-and-z-height/7715/29 "2023-03-14T05:13:11Z")

</div>

Hey all,

feel free to test this (you can copy it with all the comments directly into the ‘tool-change’ field of SETTINGS Tab):

#### Aiph5u’s ‘tool-change’ routine

&nbsp;

> | Version 2024-03-31a | |
> | (Runs on M6, tool change) | |
> | M70 | ; Save modal states |
> | G90 | ; Set absolute distance mode |
> | G21 | ; Set metric units mode |
> | S0 | ; Set spindle speed to 0 |
> | G53 G0 Z0 | ; Go rapidly to the Z machine home position - manual tool change position |
> | G53 G0 X0 Y0 | ; Go rapidly to the X,Y machine home position - manual tool change position |
> | M0 M6 (debug, Please insert tool Nr. #\<\_selected\_tool\> and tighten the collet with both wrenches) | |
> | G0 X0 Y0 | ; Go to the workpiece X and Y zero |
> | G0 Z35 | ; Lower Z to a position 35 mm above old workpiece zero before probing |
> | M0 (MSG, Please connect the touch plate to the controller, place the touch plate underneath the bit and attach the magnet end to the collet of your milling motor.) | |
> | F100 | ; Set feedrate to 100 mm/min for probing. (which means slow) |
> | G91 | ; Set incremental distance mode |
> | G38.2 Z-50 | ; Move the milling motor downwards until the bit touches the touch plate |
> | G92 Z15.4 | ; 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) |
> | G0 Z30 | ; Lift Z by 30 mm |
> | M0 (MSG, Please remove the touch plate and start the milling motor) | |
> | M72 | ; Restore the modal states that we previously saved with M70 above |
> | | |
> | --- | --- |

(Feel free to accomodate the Z-50 and the Z30 to your needs)

Note 1: The above ‘tool-change’ routine is for the case you have the workpiece zero on top of the workpiece in your 3D model. Should you have the workpiece zero at the bottom of your workpiece, you have to disable this line by prepending a semicolon:

> | 
> 
> **;** G0 X0 Y0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> 
> | ; Go to the workpiece X and Y zero |

This will make that you probe on machine bed at home position instead of workpiece top.

I will work on this to automatize the selection of these two different cases.

### How to copy this ‘tool-change’ routine to your machine

1. Open a new browser tab on the user interface and open [the page you look at at the moment](https://forum.onefinitycnc.com/t/tool-changes-and-z-height/7715/29) by navigating to its [forum.onefinitycnc.com](http://forum.onefinitycnc.com) URL or by pasting the exact URL ([https://forum.onefinitycnc.com/t/tool-changes-and-z-height/7715/29](https://forum.onefinitycnc.com/t/tool-changes-and-z-height/7715/29)) into the URL bar.

2. Please follow these steps:

 ![Screenshot_2023-09-03_20-52-07 __SETTINGS_tool-change_old__ mark](https://us1.discourse-cdn.com/flex022/uploads/onefinitycnc/original/3X/6/f/6faa0510202664b547dda01199c435d76b957f6c.png)  
On the SETTINGS page, click into the ‘tool-change’ text field, do “select all” (Ctrl-A), and “cut” (Ctrl-X)

 ![Screenshot_2023-09-03_20-55-04 __New_tool-change_routine_selected__ mark](https://us1.discourse-cdn.com/flex022/uploads/onefinitycnc/original/3X/9/d/9dc59000e3ccdf9eec817f9446e0af863490429f.png)  
Switch to the new tab which shows this forum page. Select the new routine with finger (touch screen) or pointer (mouse). Now “copy” (Ctrl-C) to clipboard.

 ![Screenshot_2023-09-03_20-58-27 __New_tool-change_routine_pasted__ mark](https://us1.discourse-cdn.com/flex022/uploads/onefinitycnc/original/3X/0/f/0fbc1ff1a22db69feda0d3da97bfa4f20e32281f.png)  
Now go back to the Onefinity User Interface tab, click into the 'tool-change" field, and “paste” (Ctrl-V)

 ![Screenshot_2023-09-03_20-58-27 __Dont_forget_to_save__ mark](https://us1.discourse-cdn.com/flex022/uploads/onefinitycnc/original/3X/0/5/05daa941c49b6f5eda367acb244b9bc7482a97bb.png)  
Click on the green “Save” button.

Now on the next occurence of [M6 (tool-change)](https://linuxcnc.org/docs/html/gcode/m-code.html#mcode:m6) in your g-code, the new tool-change routine will be used.

Note: Inside the ‘tool-change’ text field, all text after the “;” is treated as comment and ignored. Therefore you can paste the routine with all its comments, it will still work.

---

_[View the full topic](https://forum.onefinitycnc.com/t/tool-changes-and-z-height/7715)._
