On Sat, 27 Apr 2024 at 16:20, Tomaz T. <tomaz_...@hotmail.com> wrote:
> I did try your code for M100 (M100 is first line of g-code) but I guess > something isn't ok, as there is no message to be seen > OK, so this time I have tested it, and it did take a bit of work to make it work. Here is the actual Python code that is working for me #! /usr/bin/python3 import linuxcnc import sys s = linuxcnc.stat() c = linuxcnc.command() s.poll() inifile = linuxcnc.ini(s.ini_filename) print(inifile.find("EMC", "MACHINE")) if inifile.find("EMC", "MACHINE") != "MyCOnfig": c.error_msg("This G-code is for a different config") c.abort() It might not work if /usr/bin/python3 isn't your Python version. I wanted to use "#! /usr/bin/env python" but that wasn't working on my particular machine. First make sure that just typing ./M100 in the nc files directory works. It will error-out, but should at least try to execute. When that is working, then start LinuxCNC from the command line: linuxcnc & (The & means that you can carry on typing commands in the command line) When LinuxCNC is loaded and homed then you can try to run the M100 from the command-line again ./M100 And this time it should work, or at least not error. Then you can try running M100 from the command prompt, and that will work if LinuxCNC can find the file. If this all works, then you can finally try running the M100 from G-code. -- atp "A motorcycle is a bicycle with a pandemonium attachment and is designed for the especial use of mechanical geniuses, daredevils and lunatics." — George Fitch, Atlanta Constitution Newspaper, 1912 _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users