Hello Guest it is March 28, 2024, 07:45:21 PM

Author Topic: How can I have a G-Code program load and run another G-Code program  (Read 13840 times)

0 Members and 1 Guest are viewing this topic.

Offline TomR

*
  •  17 17
    • View Profile
I have three (3) G-Code programs that I would like to run sequentially.  Due to the length of each program, it would be desirable to have a snippet at the end of each program to call/load and run the next G-Code program upon its completion.  Is this possible and could you provide a snippet that might accomplish this objective.

Thanks for your time, TomR

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #1 on: April 26, 2012, 05:44:36 PM »
FIrst you need to create a mcode(macro)

'M5001 Macro to run next program
LoadRun(C:\Mach3\Gcode\NameOfNextFile.txt")

The you insert the Mcode just before the M30 and use the block delete slash.

/ M5001

This way you can turn OFF the program transfer if needed using block delete.

Now where the 1st program ends it will LOAD AND RUN the called file automaticaly. IF you want it to load and wait for a start then use

,M5001 Macro to load file
LoadFile(C:\Mach3\Gcode\NextFileName.txt")

It will load the file and WAIT for you to press start.

FOR the 2nd file load use another macro M5002 cna call the next program as you did it the first.



(;-) TP

Offline TomR

*
  •  17 17
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #2 on: April 26, 2012, 06:09:43 PM »
BR549:

Thanks for your reply. I am going to give this a shot first thing tomorrow.

I really appreciate your help,

Regards, TomR

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #3 on: April 26, 2012, 07:18:45 PM »
I have also done it another way. I created a Control macro that you could type in the files names in order of run and IT would process each gcode file in order.

(;-) TP

Offline TomR

*
  •  17 17
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #4 on: April 26, 2012, 08:16:17 PM »
My wife had to run to the store so this gave me a chance to try your macro suggestion tonight.  Sometimes she gets impatient when I work on my router in the evenings.  Women just don't understand these things.

Anyhow, when I try to write the macro I get a VB Scipter compile error and highlighting the ":"  Here is the text of the macro:

'M5001 Macro to run Push Stick.Tap
LoadRun(C:\Mach3\Gcode\push stick.tap)
 
Any ideas?

Regards, TomR

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #5 on: April 26, 2012, 09:39:08 PM »
YOu forgot teh "    " same as I did in the example

'M5001 Macro to run Push Stick.Tap
LoadRun("C:\Mach3\Gcode\push stick.tap")

Also IS "push stick" all one word OR is there really a space in between?

OOPS, (;-) TP

Offline TomR

*
  •  17 17
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #6 on: April 27, 2012, 10:46:48 AM »
Thanks BR549. 

Making the above format change has the M5001 macro working perfectly.  I tested a 3-program sequence with complete success.

Thanks for all your help.  Also "push stick"  does include the space as typed, however a good heads-up on your part.

Regards, TomR

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #7 on: April 27, 2012, 03:50:50 PM »
Just a suggestion but that space has gotten me several times in the past(;-)

I started useing a filename format as ALL one worg but capitialize the first letter in each word.

PushStick.tap

Just a thought, (;-) TP

Offline TomR

*
  •  17 17
    • View Profile
Re: How can I have a G-Code program load and run another G-Code program
« Reply #8 on: April 27, 2012, 06:18:32 PM »
Good thought, I see what you mean.

Thanks again.

Offline TomR

*
  •  17 17
    • View Profile
The mcode macro is working fine in running gcode programs sequentially.  However, the tool path is not regenerating on the tool-path screen when the macro loads and runs the gcode.  I tried using an OemButton(160) after the load/run command but without success.  Mach3 shows a dialog box indicating the tool path is being regenerated but neither regenerates the tool path nor runs the gcode.  Seems like its in some kind of loop.

'M5001 Macro to run PushStick.Tap
LoadRun("C:\Mach3\Gcode\PushStick.tap")
While IsLoading()
Wend
DoOEMButton(160)

Thanks, TomR