COVID-19 Update: MachMotion is open for business and continues to operate as an essential service.

Lathe “Custom G-Code” Cycle

Summary of videoThis four-minute video is a great introduction to the

“Custom G-Code” Cycle. The video starts with an overview of the configuration settings and then contains a practical walk-thru tutorial. The software being demonstrated is the MachMotion Lathe Canned Cycle Wizard, which is a part of the MachMotion control software and is built on Mach 4.

Video Transcript:

0:02 Welcome to MachMotion Lathe Canned Cycles. This video will give you an overview of the custom G-Code cycle. We will do a quick overview of all the information and then walk through an example. For more information about the other cycles available or the overall structure, please watch our other videos.

0:21 To start a new custom G-Code cycle, click the button labeled “Custom G-Code.” This will open the custom G-Code cycle editor. If in your settings you selected “Load Last Cycles,” you will see that the data is identical to the last custom G-Code cycle you created. If you have not made a custom G-Code cycle or your settings are set to “Use Defaults,” then you will see your default values filled in. We have two elements that form the heading of the editor. We have the cycle type listed here. If we double-click on it, the editor will collapse into a smaller frame so that it does not block as much of the screen. We can double-click on it again to expand the editor to its full size. Next to it is the name of our cycle. The editor will supply a name for us, but we can change it if we like. All names within a job must be unique.

1:17 There are five buttons that make up the foot of the editor. We have an arrow on the left and on the right that are currently disabled. Once we add this cycle to our job, we can reopen it to edit it. These buttons will allow us to jump to the next or previous cycle in the job. This button, labeled “Add to Job,” will save the cycle to the job. The “Cancel” button will exit the editor without saving any of our values. Clicking on “View Toolpath” will make the editor write G-Code for the cycle and show us the toolpath, so we can verify that everything is correct. It is recommended to always view the toolpath before adding the cycle to the job.

2:01 The custom G-Code editor has one main field in which we can write any G-Code commands we desire. These lines will be inserted directly into the generated G-Code file. Now that we have reviewed all the fields, let’s do an example. Let’s type into the field the following. We’ll set our spindle speed by typing G97 S700 and write a comment so that we know what we’re doing. Then, let’s rapid it out to a point.

2:35 We’ll go to X3 and Z0. Now that we’re at a safe point, let’s turn on our spindle (M03). Once our spindle is on, we’ll feed in just a little bit on the x (G01 X2.5), and then we’ll feed in along the z (G01 Z-3). Once we have fed in on both axis, we’ll rapid back out (G00 X3 Z-2.5). Now that we’ve written some code, let’s click on view toolpath to see what we did. We’ll collapse this so it takes up less room and just move it out of the way. We can see here that we rapid it to the point we fed in on the x axis, then we fed in on the z axis, and then rapid it back out. This looks like what we wanted; let’s go ahead and add this to the job!

3:45 This has been an overview of the MachMotion lathe canned cycles custom G-Code cycle. We hope you enjoyed it, and if you want more information, please watch our other videos.