Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TTalma on September 18, 2018, 11:48:25 AM

Title: Calling one G-Code file from another
Post by: TTalma on September 18, 2018, 11:48:25 AM
I am working on a few files for making a few different parts (12 to be exact) that are similar. The files are all several thousands of lines long. I currently have each of the major steps in making the parts broken up into different functions.

As I am troubleshooting and making changes to a function, I need to go into each of the files and make the same change.

Is it possible to break each of these functions in to their own file, and then call each of these files from a main file, so if I need to make a change I only need to do it in one place? I hope my explaination makes sense.

If there is a way can someone post a short sample?

Thanks!
Title: Re: Calling one G-Code file from another
Post by: smurph on September 28, 2018, 11:58:30 PM
In a word, subprograms.  :)  Watch this video and see the magic.  https://www.youtube.com/watch?v=fT0wjbO4NpE (https://www.youtube.com/watch?v=fT0wjbO4NpE)

The idea would be that each of your different functions would be a a subprogram.  Then any main part program could call them. 

Steve