Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: freznel on October 24, 2020, 03:58:49 AM

Title: Run Batch G-Code with hold between files
Post by: freznel on October 24, 2020, 03:58:49 AM
Hi All;

I am very new to Mach3 and was hoping that someone could assist me with a problem I need to solve.

I have 120 files that I need to run in sequence using a fixture.  Each file is only run once.

After each file, a part needs to be removed from the fixture and the new part inserted.

What I would like to do is:

1) have Mach3 open the first file
2) Wait for the Cycle Start button to be pressed
3) Run the G-Code
4) Hold for the milled part to be removed
5) Open file 2
6) Wait for the Cycle Start Button to be pressed (allows for a new blank to be loaded)
7) Run G-code for file 2

Hold for the milled part to be removed

rinse repeat...

Is there a way that this can easily be done?

Thanks for the assistance!

Mike
Title: Re: Run Batch G-Code with hold between files
Post by: BR549 on October 24, 2020, 08:01:23 PM
Are all 120 files the same or are they 120 different parts ?

(;-) TP
Title: Re: Run Batch G-Code with hold between files
Post by: freznel on October 24, 2020, 11:58:04 PM
Hi TP;

Thanks for the quick reply.  I will have 120 unique files.  I haven't set the file name structure yet so I can set that according to the solution if needed.

Mike
Title: Re: Run Batch G-Code with hold between files
Post by: BR549 on October 25, 2020, 05:31:32 PM
OK the easy way is to assemble all 120 files into 1 file with a M00 in between each section. You WOULD need to remove any M30 from the end of each file except for the end of the complete file.

Another way would be to program them as Subroutines calling each file in order and again adding a M00 at the end of each subroutine.

Another way is to try a Macro program that calls each file as an indivdual file in the order of run.

There can be quirks with each style. Things like IF you actually need to see the toolpath for each file.

Just a thought , (;-) TP
Title: Re: Run Batch G-Code with hold between files
Post by: freznel on October 25, 2020, 10:55:26 PM
Hi TP;

If I want to write them as a Subroutines, how would I go about doing it?

A macro might also be a good way to do it.  What programming language would it need to be in?

Thanks,

Mike
Title: Re: Run Batch G-Code with hold between files
Post by: TPS on October 26, 2020, 02:43:10 AM
how to run Subroutines is explained here: https://www.machsupport.com/forum/index.php?topic=7684.0

macro language will be VB

example to run files with different names:

Code: [Select]
Sub Main()

LoadRun("C:\Mach3\Gcode\file1234.tap")
Code "M00"
LoadRun("C:\Mach3\Gcode\fileabc.tap")
'and so on

Code"M30"
End Sub

example if file names are numbered:

Code: [Select]
Sub Main()
   For i = 1 To 120
LoadRun("C:\Mach3\Gcode\file" & i & ".tap")
If i <> 120 Then
Code "M00"
Else
Code"M30"
End If
   Next i
End Sub

code example not tested just written down.