Merge Two Gcode Files to Save Time and Eliminate Re-creation of Machining Operations
This is a tutorial on how to merge/combine 2 Gcode files to save time and eliminate the need for replication of machining operations. These files are generally produced using a CAM program and are used to control a CNC Machine/Router. The Gcode file contains instructions for moving the the machine and controlling various peripherals connected to the machine.
The file used in the video to demonstrate the combining technique contains many parts, but it only occupies half of the area of the 4x8 sheet stock that is being used.
In the video we will illustrate how to create another file that positions these parts rotated on the empty portion of the 4x8 sheet. That file is then saved and the two Gcode files that have been generated will be manually merged using the CAM program. In the video CAMBAM is the software used, but this technique should work fine with other CAM programs as well.
The first step is to produce a Gcode file for this particular file. Next a boundary is drawn where the parts will be aligned against. This is done because the original parts will be moved and the initial location will be lost. For the next step, select the parts, rotate and move them into place using CTRL-R to rotate and CTRL-M to move. The parts should be moved close enough to save material, but not so close that the cut will interfere with the other parts. Optionally, you can carefully align the holding tabs and make the parts closer to reduce wear on the end mill and save more material.
Save the new file with a unique name so that you don't save over the original file. Produce a Gcode file as well. Now the Gcode files can be merged manually. Open the two files and place them side by side. Copy the contents of the 2nd file between the common initialization instructions and the ending control instructions. These are the general motion instructions.
Go back to the first file and at the end, just before the ending control instruction, paste the copied instructions. Now close the 2nd file without saving it. Save the first file with a unique name and open it in your CAM program and inspect it. If your CAM program has a simulation, use it to confirm the change was successful.