Manual Toolchange + Abs Z Probe (QtDragon)

More
1 year 5 months ago - 1 year 5 months ago #328543 by SanzuiWorks
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!
Last edit: 1 year 5 months ago by SanzuiWorks.

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago #328612 by cmorley

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago - 1 year 5 months ago #328615 by SanzuiWorks
This is the first time I've seen the filter function. I need to learn about this first.
Last edit: 1 year 5 months ago by SanzuiWorks.

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago - 1 year 5 months ago #328617 by SanzuiWorks
This requires QtDragon to support parsing (MDI_COMMAND, Gxx) output from FILTERs and executing it as an MDI command.  


load_wsc_from_ngc.py
Code:
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
Code:
[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: 1 year 5 months ago by SanzuiWorks.

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago #328853 by SanzuiWorks
So far, this method is not working well.
Nothing happens when I load the NGC. For now, I would like to try a different method.

I am considering creating an action button that retrieves the first WSC from the loaded NGC and sends it to the MDI. ...

Please Log in or Create an account to join the conversation.

More
1 year 5 months ago #328861 by MennilTossFlykune

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!
 
You can add this under StatCanon in qt5_graphics.py:
Code:
    def set_g5x_offset(self, index, x, y, z, a, b, c, u=None, v=None, w=None):         interpret.Translated.set_g5x_offset(self, index, x, y, z, a, b, c, u, v, w)                 g5x = {             1: 54,             2: 55,             3: 56,             4: 57,             5: 58,             6: 59,             7: 59.1,             8: 59.2,             9: 59.3         }         print(f"G{g5x[index]} on line {self.lineno}")

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.444 seconds
Powered by Kunena Forum