Manual Toolchange + Abs Z Probe (QtDragon)
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
03 May 2025 12:05 - 16 May 2025 07:02 #327594
by SanzuiWorks
Manual Toolchange + Abs Z Probe (QtDragon) was created by SanzuiWorks
I'd like to share a structured and slightly modified version of `qt_auto_probe_tool.ngc` I'm using on my self-built 3-axis CNC with LinuxCNC 2.9.3 and the QtDragon GUI.
---
### ? My Goals:
- Separate tool length offset from work coordinate systems (WCS)
- Make the tool table intuitive and readable
- Ensure safe and efficient probing using machine coordinates
---
#### 1. Set the Probe Top:
I defined the probe top using the tip of the spindle body (with no tool/collet) as a consistent mechanical reference.
- For example, if the empty spindle is lowered to Z = -120 (machine coordinates), I input `-120` as PROBE HT in the QtDragon Probe tab.(I know this is not the intended use.)
- I do not use BLOCK HT at all.
#### 2. Define Work Coordinates:
Once a tool is mounted (e.g., Tool #1 with 30mm protrusion), I:
- Add `T1 Z30` into the tool table
- Set up the G54 (or other WCS) normally
This way, the tool length stored in the table is actual physical protrusion and independent from any WCS — much more intuitive for manual tool changers.
Use G43 to apply the offset.
---
- Tool table values are stable and logical (they represent actual tool lengths).
- Easy to estimate and input values for new tools before probing.
- Tool probing uses machine coordinates, so:
- Probe start position can be calculated from tool length
- No dependency on current WCS
- Safer: if tool table Z is negative by mistake, start offset is clamped to zero
- Multi-WCS workflows (G54, G55...) work seamlessly — no need to re-probe per WCS
- Tool probing is simpler and can be single-pass since start is close
---
Thanks,
SanzuiWorks
---
### ? My Goals:
- Separate tool length offset from work coordinate systems (WCS)
- Make the tool table intuitive and readable
- Ensure safe and efficient probing using machine coordinates
---
#### 1. Set the Probe Top:
I defined the probe top using the tip of the spindle body (with no tool/collet) as a consistent mechanical reference.
- For example, if the empty spindle is lowered to Z = -120 (machine coordinates), I input `-120` as PROBE HT in the QtDragon Probe tab.(I know this is not the intended use.)
- I do not use BLOCK HT at all.
#### 2. Define Work Coordinates:
Once a tool is mounted (e.g., Tool #1 with 30mm protrusion), I:
- Add `T1 Z30` into the tool table
- Set up the G54 (or other WCS) normally
This way, the tool length stored in the table is actual physical protrusion and independent from any WCS — much more intuitive for manual tool changers.
Use G43 to apply the offset.
---
- Tool table values are stable and logical (they represent actual tool lengths).
- Easy to estimate and input values for new tools before probing.
- Tool probing uses machine coordinates, so:
- Probe start position can be calculated from tool length
- No dependency on current WCS
- Safer: if tool table Z is negative by mistake, start offset is clamped to zero
- Multi-WCS workflows (G54, G55...) work seamlessly — no need to re-probe per WCS
- Tool probing is simpler and can be single-pass since start is close
---
Thanks,
SanzuiWorks
Last edit: 16 May 2025 07:02 by SanzuiWorks.
Please Log in or Create an account to join the conversation.
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
03 May 2025 13:16 - 09 May 2025 16:28 #327597
by SanzuiWorks
Replied by SanzuiWorks on topic Manual Toolchange + Abs Z Probe (QtDragon)
I created a diagram so that the offset value can be visually confirmed.
Last edit: 09 May 2025 16:28 by SanzuiWorks.
Please Log in or Create an account to join the conversation.
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
09 May 2025 17:01 - 13 May 2025 06:53 #328088
by SanzuiWorks
Replied by SanzuiWorks on topic Manual Toolchange + Abs Z Probe (QtDragon)
In the conventional method, if the table bottom is always set to G54_Z0, there is no problem with setting [BLOCK HT], but if the work top is set to WCS, [BLOCK HT] must be changed frequently.
Changing is troublesome, and checking the current setting value is also cumbersome.
If the WCS or [BLOCK HT] changes, the tool table value also changes.
Also, I cannot read what the offset value in the tool table indicates.
After the change,
Z height can be set in WCS as well as XY,
so the situation can be checked from the main screen.
In particular, the Z height is consistent, and is reflected when the WCS is switched.
The tool is always consistent with positive compensation.
The Z_offset in the tool table is easy to read because it lists the tool length.
Since the tool offset is consistent, it can be approached at high speed in advance when probing. This is expected to reduce probe time, especially on slow-moving machines.
If the previous tool length could be displayed in the tool change dialog, human error would also be reduced.
So far we haven't had any major issues,
but we'd like other people to take an interest and find ways to improve it.
Changing is troublesome, and checking the current setting value is also cumbersome.
If the WCS or [BLOCK HT] changes, the tool table value also changes.
Also, I cannot read what the offset value in the tool table indicates.
After the change,
Z height can be set in WCS as well as XY,
so the situation can be checked from the main screen.
In particular, the Z height is consistent, and is reflected when the WCS is switched.
The tool is always consistent with positive compensation.
The Z_offset in the tool table is easy to read because it lists the tool length.
Since the tool offset is consistent, it can be approached at high speed in advance when probing. This is expected to reduce probe time, especially on slow-moving machines.
If the previous tool length could be displayed in the tool change dialog, human error would also be reduced.
So far we haven't had any major issues,
but we'd like other people to take an interest and find ways to improve it.
Last edit: 13 May 2025 06:53 by SanzuiWorks.
Please Log in or Create an account to join the conversation.
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
13 May 2025 06:39 #328349
by SanzuiWorks
I had been using it without much thought, but it seems better to remove G43H0 G54.
The tool length offset is unintentionally canceled, and the work coordinate system switches."
Replied by SanzuiWorks on topic Manual Toolchange + Abs Z Probe (QtDragon)
[RS274NGC]
RS274NGC_STARTUP_CODE = G17 G21 G40 [color=#f1c40f]G43H0 G54[/color] G64P0.0005 G80 G90 G94 G97 M5 M9
I had been using it without much thought, but it seems better to remove G43H0 G54.
The tool length offset is unintentionally canceled, and the work coordinate system switches."
Please Log in or Create an account to join the conversation.
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
13 May 2025 06:50 - 13 May 2025 06:52 #328350
by SanzuiWorks
Replied by SanzuiWorks on topic Manual Toolchange + Abs Z Probe (QtDragon)
Reading Work Coordinates When Loading a New NGC File
When loading a new `.ngc` file in LinuxCNC, is it possible to read the work coordinates at that stage? Since the G-code has not been executed yet, the work coordinates might not be applied.
Would it be possible to create a custom button, similar to "WCS Sync," that reads the `.ngc` file and sends commands like `G55` to MDI?
Has anyone implemented something similar, or does LinuxCNC provide a built-in way to achieve this? Any insights or suggestions would be greatly appreciated.
Thanks!
When loading a new `.ngc` file in LinuxCNC, is it possible to read the work coordinates at that stage? Since the G-code has not been executed yet, the work coordinates might not be applied.
Would it be possible to create a custom button, similar to "WCS Sync," that reads the `.ngc` file and sends commands like `G55` to MDI?
Has anyone implemented something similar, or does LinuxCNC provide a built-in way to achieve this? Any insights or suggestions would be greatly appreciated.
Thanks!
Last edit: 13 May 2025 06:52 by SanzuiWorks.
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
-
Less
More
- Posts: 7907
- Thank you received: 2142
15 May 2025 12:25 #328507
by cmorley
Replied by cmorley on topic Manual Toolchange + Abs Z Probe (QtDragon)
Can you post the changes you made?
Please Log in or Create an account to join the conversation.
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
16 May 2025 07:00 - 16 May 2025 07:02 #328543
by SanzuiWorks
Replied by SanzuiWorks on topic Manual Toolchange + Abs Z Probe (QtDragon)
Thanks for your interest! I made several modifications to qt_auto_probe_tool.ngc to improve tool length offset management and work coordinate independence.
Changes Made:
Separated tool length offset (G43) from work coordinate systems (G54/G55), making the tool table more intuitive.
The probe height was defined in machine coordinates and probed at the tip of the spindle.
Ensured tool length offset remains consistent regardless of WCS changes.
Thanks!
Changes Made:
Separated tool length offset (G43) from work coordinate systems (G54/G55), making the tool table more intuitive.
The probe height was defined in machine coordinates and probed at the tip of the spindle.
Ensured tool length offset remains consistent regardless of WCS changes.
Thanks!
Last edit: 16 May 2025 07:02 by SanzuiWorks.
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
-
Less
More
- Posts: 7907
- Thank you received: 2142
17 May 2025 06:34 #328612
by cmorley
Replied by cmorley on topic Manual Toolchange + Abs Z Probe (QtDragon)
How about a gcode filter?
linuxcnc.org/docs/devel/html/gui/filter-programs.html
linuxcnc.org/docs/devel/html/gui/filter-programs.html
Please Log in or Create an account to join the conversation.
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
17 May 2025 09:14 - 17 May 2025 09:17 #328615
by SanzuiWorks
Replied by SanzuiWorks on topic Manual Toolchange + Abs Z Probe (QtDragon)
This is the first time I've seen the filter function. I need to learn about this first.
Last edit: 17 May 2025 09:17 by SanzuiWorks.
Please Log in or Create an account to join the conversation.
- SanzuiWorks
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 4
17 May 2025 09:40 - 21 May 2025 03:45 #328617
by SanzuiWorks
Replied by SanzuiWorks on topic Manual Toolchange + Abs Z Probe (QtDragon)
This requires QtDragon to support parsing (MDI_COMMAND, Gxx) output from FILTERs and executing it as an MDI command.
load_wsc_from_ngc.py
.ini
When you run the program directly, you can obtain the WSC, but it does not run automatically during the NGC loading.
load_wsc_from_ngc.py
import re
import linuxcnc
import os
def on_button_detect_wcs(self):
filename = STATUS.file
if not os.path.exists(filename):
print("G-code file not found.")
return
try:
with open(filename, 'r') as f:
for line in f:
m = re.search(r'\bG5(4|5|6|7|8|9)(\.\d)?\b', line.upper())
if m:
g_code = m.group(0)
print(f"Detected WCS: {g_code}")
c = linuxcnc.command()
s = linuxcnc.stat()
s.poll()
if s.task_state == linuxcnc.STATE_ON and s.interp_state == linuxcnc.INTERP_IDLE:
c.mode(linuxcnc.MODE_MDI)
c.wait_complete()
c.mdi(g_code)
else:
print("Interpreter not idle. Cannot send MDI.")
return
print("No WCS (G54~G59.3) found.")
except Exception as e:
print(f"Error: {e}")
.ini
[FILTER]
PROGRAM_EXTENSION = .ngc G-Code File
FILTER = load_wsc_from_ngc.py .ngc
When you run the program directly, you can obtain the WSC, but it does not run automatically during the NGC loading.
Last edit: 21 May 2025 03:45 by SanzuiWorks.
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.214 seconds