On Tue, 23 Apr 2024 at 21:53, Tomaz T. <tomaz_...@hotmail.com> wrote:

> I have created two configurations of LinuxCNC to be able to run may
> machine in two different (mechanical) configurations. Now I would like to
> prevent to run wrong g-code.
> Is maybe there a custom M-code that I could use for that and it would
> prevent further execution if it doesn't match with running configuration?
>

How would you decide which config the G-code was for?

 If you want to put an M-code in the G-code, and that is what determines
the target machine of the G-code, then maybe a custom M-code is the way, as
you suggest.

Something like M100 for one config, and M101 for the other.

file: M100

#! /usr/bin/env/ python
import linuxcnc
if inifile.find("EMC", "MACHINE")  != "LinuxCNC-HAL-SIM-AXIS":
    c = linuxcnc.command()
    c.error_msg("This G-code is for a different config")
    c.abort()

Make the file executable, put it in the  nc_files directory, (or in the
SUBROUTINE_PATH) and it will abort running the G-code when it runs M100 if
the MACHINE entry in the active INI is not the specified string.

Probably. I haven't tested it :-)

-- 
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

Reply via email to