Restarting a G-Code Program After an Error

Introduction

Occasionally, an error will cause your g-code to stop and you don’t want to watch your Pocket NC V2 cut air before resuming again where the machine last stopped. This document describes two methods to modify your original g-code program to resume your code after an error. The first method suppresses tool operations that have already been completed in your CAM package before reposting a modified g-code file. For the purpose of this tutorial, Fusion 360 will be used to describe the process. Other CAM software operation varies but the process is similar. The second method uses the Penta Machine Company simulator to modify the original g-code to eliminate completed tool operations.

It is important that you remedy the situation that caused the error to occur. For instance, if you experience a

“Joint 4 Following Error”

then you will want to reduce the feed rate for the remaining tool operations.

 

Preamble

The g-code program’s preamble comes at the start of the program. The g-code preamble sets up the machine. For instance the G20 or G21 command would be found in the preamble to instruct the machine to use inches or mm, respectively. The preamble must be included in the g-code program.

Method 1: CAM Modification

Suppressing Tool Operations

The Pocket NC user interface will indicate the last line of code executed before an error occurred. Follow the code back until you discover the tool operation that was in process. This would be the ROUGH FACE FRONT tool operation for the g-code displayed in the INTRODUCTION.

If you are using Fusion 360, open your CAM software and locate the tool operations that come before the tool operation that did not complete. Right click on a tool operation and select SUPPRESS. A suppressed tool operation no longer has a check mark but a circle with a dash inside it. Suppressed tool operations will be ignored by the post processor.

 

Post New G-Code

Below is an example of the tool operations to suppress for the g-code program mentioned in the INTRODUCTION.

Once the tool operations that have already completed are suppressed, post a new g-code program. Below is an example of a g-code program that has eliminated completed tool operations. Note that the g-code preamble remains the same in both the complete and partial versions of the g-code.

Regenerate Tool Operations

Once a tool operation has been suppressed in Fusion 360, it will need to be regenerated. Highlight all the suppressed tool operations and perform a GENERATE action as shown below.

Load Modified G-Code

Load the modified g-code into the Pocket NC V2 user interface. Executing this code should begin at the tool operation where the error occurred. Ensure that the Tool Length Offset and G5x values are correct.

Method 2: Modifying Code using the Penta Simulator

This method involves using the Penta Simulator to modify the g-code and to eliminate tool operations that the program has already performed. This method works well when the g-code program is stopped for errors such as reaching a temperature limit (V2-50) or when experiencing a “Joint 2 Positive/Negative Limit” error. This is a good time to enter the Tool Length Offset and G5x values into the simulator.

Load g-code program into the Penta Simulator

Load the g-code program into the Penta Machine Company Simulator.

Stop the g-code program

Click the Stop/Start Program button on the Play Menu to stop the program.

Locate the unfinished tool operation

Under the G-CODE section of the simulator, use the FIND function (CTRL-F or CMD-F) to locate the unfinished tool operation.

Select the g-code above this point up to but not including the preamble and delete this section of code.

Save the modified program

Scroll to the bottom of the G-CODE section in the simulator. Locate the filename section and rename the program. Use the download button to save the modified program.

The modified file will be saved to your DOWNLOADS folder.

Load the modified g-code program into the Pocket NC V2

Once you are certain that the error will not occur again, load the modified g-code program into the Pocket NC V2. Ensure that the Tool Length Offset and G5x values are correct.

 

Try using the Penta Simulator to modify the Clamp g-code example

Below is an embedded version of the Penta Simulator with the Clamp - Complete.ngc file loaded. You can use this embedded version of the Penta Simulator to experiment with modifying the g-code program and removing completed tool operations.

 

See the image below on how to toggle the G Code Pane ON and OFF.

Conclusion

The methods described above are both conservative methods. There are ways to eliminate cuts that have already been performed by the machine in the tool operation where the error occurred. Caution must be observed to not remove machine setup information at the beginning of the tool operation. The description of this process is outside the scope of this tutorial.