Welcome, Guest. Please login or register.
Did you miss your activation email?
October 21, 2014, 10:11:40 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  G-Code, CAD, and CAM
| |-+  G-Code, CAD, and CAM discussions
| | |-+  How can I have a G-Code program load and run another G-Code program
Pages: 1 2   Go Down
Print
Author Topic: How can I have a G-Code program load and run another G-Code program  (Read 2825 times)
0 Members and 1 Guest are viewing this topic.
TomR
Active Member

Offline Offline

Posts: 17


View Profile
« on: April 26, 2012, 03:26:48 PM »

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
Logged
BR549
Mach4 Alpha

Offline Offline

Posts: 5,120


View Profile
« Reply #1 on: April 26, 2012, 04: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
Logged
TomR
Active Member

Offline Offline

Posts: 17


View Profile
« Reply #2 on: April 26, 2012, 05: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
Logged
BR549
Mach4 Alpha

Offline Offline

Posts: 5,120


View Profile
« Reply #3 on: April 26, 2012, 06: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
Logged
TomR
Active Member

Offline Offline

Posts: 17


View Profile
« Reply #4 on: April 26, 2012, 07: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
Logged
BR549
Mach4 Alpha

Offline Offline

Posts: 5,120


View Profile
« Reply #5 on: April 26, 2012, 08: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
Logged
TomR
Active Member

Offline Offline

Posts: 17


View Profile
« Reply #6 on: April 27, 2012, 09: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
Logged
BR549
Mach4 Alpha

Offline Offline

Posts: 5,120


View Profile
« Reply #7 on: April 27, 2012, 02: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
Logged
TomR
Active Member

Offline Offline

Posts: 17


View Profile
« Reply #8 on: April 27, 2012, 05:18:32 PM »

Good thought, I see what you mean.

Thanks again.
Logged
TomR
Active Member

Offline Offline

Posts: 17


View Profile
« Reply #9 on: May 01, 2012, 04:45:42 PM »

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
Logged
Pages: 1 2   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!