
CNC12 V5.08 Tool Probing & Tool Change Macro Update

New version with improved tool change positioning in Z!
We have reviewed and optimized the mfunc6.mac macro, allowing CNC12 V5.08 users to perform manual tool changes while ensuring precise tool measurement and reliable tool management.

Improvements made:

Secure tool change positioning in Z β Adapted to all user setups.

Optimized probing cycle β Adjusted for better accuracy and reliability.

Why use this macro?

Automatic and reliable tool length measurement

Advanced tool management without an ATC

Improved safety during tool changes

Optimized setup and machining time

File Name: mfunc6.mac

Recommended Location: C:\cncm\system\

Your feedback is welcome! If you test this new version or have suggestions for improvement, feel free to share them here.

Here is the explanatory document I am providing along with the downloadable macro.
## **Read Me - CNC12 V5.08 Tool Probing & Tool Change Macro**
### **Description**
This macro is designed for CNC12 V5.08 users performing manual tool changes.
It enables each tool to be measured, automatically saves its length in the CNC12 tool library, and validates the tool in the spindle with its number and H value on the **DRO (Digital Readout)**.
With this method, users can machine parts using multiple tools in the same program without needing an ATC, while ensuring precise tool compensation and reliable tool management.
### **Prerequisites Before Use**
- Disable `"Ref Tool"`
- Define the tool change location (`G53 X0 Y-400`)
- Add a Z clearance move before fast positioning above the probe
- **Use `P003=6`**, which sets `Z Home = Z Ref` and activates the tool height retention option
- Perform a test before production
### **Macro Workflow**
1. Secure clearance before positioning
2. Move to the tool change location
3. Display a message prompting the user to insert the new tool
4. Fast positioning above the probe
5. Probe the tool and record its length
6. Apply tool compensation
7. Secure return in Z

**File Name:** `mfunc6.mac`

**Recommended Location:** `C:\cncm\system\`
---
### **CNC12 V5.08 Tool Probing & Tool Change Macro**
### **Prerequisites Before Activating in CNC12**
- **Verify Probe Configuration**
The macro checks if the probe is properly configured before starting via a call to the `tt_check_configuration.cnc` function.
The probe position must be fixed and defined in the CNC12 Wizard.
- **Disable the "Ref Tool" Method**
Before activating the macro, `"Ref Tool"` must be disabled if it was active.
Reset the tool reference **in the CNC12 library**, by setting the Z axis at its highest point (`G53 Z[Max Value]`).
Then, perform a new reference take (`Ref Tool`) at this position to ensure an accurate tool length measurement.
After completing this step, `"Ref Tool"` can be disabled in the CNC12 Wizard.
Without this step, if a tool is measured via the CNC12 library using auto-measure, the recorded value may differ.
- **Define Tool Change Position**
Each user must define the **X and Y** position for the tool change (`G53 X0 Y-400`) based on their machine setup.
This location should be accessible and safe for manual handling.
- **Add Z Clearance Before Fast Positioning Above the Tool Probe**
It is recommended to add a `G53 Z[Clearance Value]` before fast positioning above the tool probe.
This ensures a secure clearance and avoids any collision risk before approaching the probe.
- **Use `P003=6`**
`P003=6` sets **`Z Home = Z Ref`** and activates **the tool height retention option**.
Before probing, the machine must move to this position to ensure a correct and secure measurement cycle.
Each user can adjust this position according to their machineβs probe setup.
- **Perform a Test Before Production**
Always test the macro **in a secure area** before integrating it into an actual machining process.
### **Macro Workflow**
1. Macro launch
2. Secure clearance (`G53 Z0`) before positioning at the tool change location
3. Move to the predefined location (`G53 X0 Y-400`)
4. Display message `M200` prompting the user to insert the new tool
5. Secure clearance (`G53 Z0`) before probing
6. Move to the probe position (`G30 P003`)
7. Automatic probing via `M115 /Z` and `M116 /Z`
8. Save tool length via `G10` in the CNC12 library
9. Apply tool compensation using `G43` and validate on the **DRO**
10. Secure return in Z (`G90` then `G53 Z0`) before resuming the program
### **Complete Macro Example in G-code**
```gcode
;------------------------------------------------------------------------------
; File Name: mfunc6.mac
; Description: Tool probing and recording in the tool library with tool validation and length in spindle
; Note: Optimized for CNC12 with manual tool insertion
; Requires: CNC12 V5.08
;------------------------------------------------------------------------------
; **Tool Touch Fix must be properly set in the CNC12 Wizard**
; **Parameter P003=6 sets `Z Home = Z Ref` and activates the tool height retention option**
IF #50001 ; Prevent lookahead buffer execution
N500 ; Check tool probe configuration
G65 "C:\cncm\system\tt_check_configuration.cnc"
;-- Positioning before tool change --
N600
G53 Z0 ; **Initial Z clearance (user-defined)**
G53 X0 Y-400 ; **Tool change position X Y (user-defined)**
G53 Z0 ; **Tool change position in Z (user-defined)**
M200 "Insert tool, press Cycle Start to continue..."
G53 Z0 ; **Safety clearance before probing**
;-- Tool probing cycle, Block 550 --
N550
IF #9432 == 0 THEN G30 P003 G91 X0 Y0 Z0
IF #9432 == 1 THEN M201 "Moving to probe surface\nPress Cycle Start to continue."
M115 /Z P[#33001] F[#33002] ; **Fast descent to contact the probe**
M116 /Z P-[#33001] F[#33003] ; **Slight retraction**
M115 /Z P[#33001] F[#33003] ; **Slow re-probing**
G10 H[#12000] R[#5023] ; **Save tool length in the library**
G43 H[#12000] ; **Apply tool compensation**
G90 ; **Explicit switch to absolute coordinates**
G53 Z0 ; **Return to Z-home**