Hello Guest it is June 10, 2025, 07:37:30 PM

Author Topic: Running a Gcode file from a button in Mach4  (Read 1566 times)

0 Members and 1 Guest are viewing this topic.

Running a Gcode file from a button in Mach4
« on: February 03, 2025, 05:53:38 PM »
What I am trying to accomplish is to click a button on my screenset in Mach4 and run a file (some-gcode.tap).  I am currently running Mach3 and using the Mach4 demo for testing.  I have spent all day looking through the docs, reading the forums, and trying things in the demo, but I either get "Line 0: Feature not licensed," or "Line 0: Subroutine file not found," or nothing at all.

Can anyone either point me to where I can read about this or take pity on me and show me a Lua script I can put in a button?

I've been using the "Exectute GCode.mcs" in the LuaExamples folder.  I've used the O9010 file in the examples folder and a file a created with a couple lines of simple Gcode (e.g. G0 X1).  For the M98 line I've tried:

Code: [Select]
M98 P9010 Q1

and:

Code: [Select]
M98 Q1 (Subroutines\\9010.tap)
Re: Running a Gcode file from a button in Mach4
« Reply #1 on: February 04, 2025, 04:59:55 PM »
I still can't get M98 to take anything other than an O1234 file name.  I would like to figure out how that works, if somebody could tell me.  For now, I've got something working with mc.mcCntlLoadGcodeFile:
Code: [Select]
local inst = mc.mcGetInstance()
local filePath = "C:\\Mach4Hobby\\Subroutines\\test.tap"

mc.mcCntlLoadGcodeFile(inst, filePath)
wx.wxMilliSleep(100) --sleeps for 0.1 seconds
mc.mcCntlCycleStart(inst)