REMAP=M6 modalgroup=6 python=atc_toolchange

More
07 Oct 2025 23:03 #336067 by Doc_emmet
Hello, I'm trying to run a Python file with REMAP=M6 modalgroup=6 python=atc_toolchange, but when I start Linuxcnc, I get the message: Hard Limits Are Reset To Active! The Python file doesn't say what could be causing this. Does anyone have an example of how I can run a Python file with REMAP=M6?

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

More
08 Oct 2025 15:26 #336100 by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
I think that is just a GUI message (qtDragon?). What makes you think it is due to your remap?

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

More
08 Oct 2025 18:24 - 08 Oct 2025 18:32 #336110 by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Hello, yes QtDragon, Linuxcnc is running without any problems. However, as soon as I insert the line REMAP=M6 modalgroup=6 python=atc_toolchange, Linuxcnc starts with a significant delay, then displays the error message "Hard Limits Are Reset To Active!" and I can't even use it. I call this test program with M6:

import linuxcnc
import time

def atc_toolchange(**words):

s = linuxcnc.stat()

if not all(axis.homed for axis in s.axis[:3]): # XYZ
return linuxcnc.INTERP_OK

c = linuxcnc.command()
c.mdi("G53 G0 Z100")

while s.interp_state != linuxcnc.INTERP_IDLE:
s.poll()
time.sleep(0.05)

return linuxcnc.INTERP_OK

Thank you very much for your effort.
Last edit: 08 Oct 2025 18:32 by Doc_emmet.

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

More
08 Oct 2025 19:01 - 08 Oct 2025 19:01 #336113 by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Have you started your config from a terminal to check for errors in the terminal output?

$ linuxcnc


Also some of your remap code looks a bit odd (eg. 'linuxcnc.INTERP_OK)
You might want to have a look at some examples:
github.com/LinuxCNC/linuxcnc/blob/master...rted/python/remap.py
Last edit: 08 Oct 2025 19:01 by Aciera.

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

More
08 Oct 2025 20:51 #336119 by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
this is my new test file remap_m6:

#!/usr/bin/env python3
from interpreter import INTERP_OK, INTERP_EXECUTE_FINISH, INTERP_ERROR

print(">>> remap_m6.py wird geladen <<<")

def remap_m6(self, **words):
try:
tool_number = words.get('t', 1)
print(f">>> M6 Werkzeugwechsel aufgerufen: T{tool_number} <<<")
# Sofort fertig melden
yield INTERP_EXECUTE_FINISH
except Exception as e:
print("Fehler in remap_m6:", e)
yield INTERP_ERROR

yield INTERP_OK

But this is supposedly not executable?

'remap_m6' is not a Python callable function - 49:REMAP = M6 modalgroup=6 python=remap_m6

I've already made some Python scripts that work, so why is it so different when called with M6?

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

More
08 Oct 2025 22:31 #336124 by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Can you create a small Python file (as simple as possible) that when I call it via REMAP = M6 modalgroup=6 python=remap_m6 , for example, only moves the Z-axis by 10mm

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

More
09 Oct 2025 14:30 #336149 by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Your last test file works fine for me.

Sounds like you might not have things set up right in your ini file.
Do you have TOPLEVEL defined correctly in the [PYTHON] section (your path might be different):
[PYTHON]
PATH_PREPEND= python

# import the following Python module
TOPLEVEL= python/toplevel.py

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

More
09 Oct 2025 19:39 #336173 by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Hello, what is the content of toplevel.py?

import oword
import remap

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

More
10 Oct 2025 05:37 #336182 by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
have a look at the example config in the 'sim/axis/remap' folder:
github.com/LinuxCNC/linuxcnc/tree/master...emap/getting-started

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

Time to create page: 0.099 seconds
Powered by Kunena Forum