Custom M-Code (Python)

More
4 years 7 months ago #238066 by andypugh
Replied by andypugh on topic Custom M-Code (Python)
At the moment, for reasons I don't fully understand, emcanon is only available in remaps.

Please Log in to join the conversation.

More
4 years 7 months ago #238068 by cmorley
Replied by cmorley on topic Custom M-Code (Python)
emccanon is called from the internal python instance in remaps.
The internal instance is invoked from linuxcnc's c++ code, so has linuxcnc's internals in it's context.

Any other instance of python will be in a different context.

That's the high level explanation.

Please Log in to join the conversation.

More
4 years 2 months ago #249052 by cncbeagle
Replied by cncbeagle on topic Custom M-Code (Python)
Andy, Todd,

Thank You!
Prompting for a parameter entry seemed like such a simple thing but that was not the case. I would never have figured out how to do this myself. You're solution was relatively easy to implement and works great.

Thanks again.

John

Please Log in to join the conversation.

More
4 months 1 day ago #347392 by Todd Zuercher
I was wanting to revisit this, and tried to make it work with the current version of linuxcnc, but it seems that the switch from Python2 to Python3 has rendered the python remap script non functional.

At first Linuxcnc wouldn't even start. But with clues from error messages I changed the 4th line from:
Code:
from Tkinter import *
to:
Code:
from tkinter import *

And that got the config running again.  But it still doesn't work right and now there are no error messages.  The input window opens, but it is completely empty except for the OK button and the title doesn't show in the title bar.  So at least a little of the Tkinter is working, but not most of it.

Please Log in to join the conversation.

More
4 months 1 day ago #347394 by MaHa
Replied by MaHa on topic Custom M-Code (Python)
I don't know if this helps, as i am usually wrong. In a project with tkinter yesnobox, thats the first lines of the python file


Code:
#! /usr/bin/python3 import tkinter as tk import tkinter.messagebox import sys import linuxcnc import time root = tk.Tk() root.withdraw()

Please Log in to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum