Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: TomR on April 26, 2012, 04: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
-
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
-
BR549:
Thanks for your reply. I am going to give this a shot first thing tomorrow.
I really appreciate your help,
Regards, TomR
-
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
-
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
-
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
-
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
-
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
-
Good thought, I see what you mean.
Thanks again.
-
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
-
YOU may want to try the other method
Loadfile("C:\Mach3\Gcode\PushStick.tap") 'Load new file
While IsMoving()
Sleep(1000)
Wend
DoOemButton(160) ' Regen toolpath
While Ismoving()
Sleep(5000)
Wend
DoOemButton(0) 'Start program
(;-) TP
-
I tried the above macro but found the tool path regeneration oembutton 160 goes into some kind of indefinite loop. The tool path dialog box opens indicating the tool path is being regenerated but only "hangs" there indefinitely. Cycle Start never executes.
Also, I assume DoOemButton(0) is a typo and should be DoOemButton(1000).
Thanks, TomR
-
SO far eveything has worked here, BUT that is not unusual. IT MAY be the files that you are trying to use. CAN you post teh files so I can test them here.
Try this method, It does work here as well.
'M5001 Macro
DoButton(169) 'Close Current G-Code file
LoadRUN("C:\Mach3\Gcode\RR2.txt") 'Load Next G-Code File
While ISmoving()
SLeep(5000)
Wend
-
IF you do not want the 5sec pause remove the
Sleep(5000)
-
Attached are the three test files I have been using. It is actually the Road Runner divided into three separate files.
Thanks, TomR
-
Tom I have tested here and it works fine stiching all 3 files together.
(;-) TP
-
Hi TomR,
are you using a licensed or the demo version of Mach3, the Demo version has limitations.
Graham
-
Well that appears to be the problem. I have a licensed version at our shop but a demo version at home where I do most of my code development. When I used BR549's macro on the licensed version, it worked fine. I was surprised to find the demo has such limitations.
Sorry guys and I hope I didn't waste your time. I really appreciate your help.
Regards, TomR
-
Art pretty much knew most of the ways around the 500 line demo restricitons(;-). THere ARE a few that work BUT they shall remain unmentioned
(;-) TP
-
Pretty please! I won't tell anyone.