Skip to content

Running a job (#3): loading, preparing and running Gcode with LinuxCNC

Jason Webb edited this page Jul 27, 2017 · 17 revisions

Quick links:

  1. Launch LinuxCNC with Mesa 4x4 configuration
  2. Load and view your G-code
  3. Unlock and enable the machine
  4. Home all axes
  5. Jog machine to desired origin on workpiece
  6. Align machine coordinates to workpiece
  7. Jog the machine around your job to check travel
  8. Run your job in the air to check travel
  9. Touch off Z axis to top of workpiece
  10. Put on personal protective equipment
  11. Run your job
  12. Monitoring, pausing and stopping your job


IMPORTANT! Before you load and run any G-code make sure you have done the following:

  1. Checked the machine for any significant mechanical problems and cleared debris
  2. Properly installed an appropriate end mill or router bit into the spindle
  3. Powered on and checked the machine's electronics system
  4. Logged on to the host machine PC
  5. Secured your workpiece to the spoilboard


1. Launch LinuxCNC with Mesa 4x4 configuration

Use the "Mesa 4x4" desktop icon to launch LinuxCNC pre-configured with all the settings for our machine.


2. Load and view your G-code

Load your G-code file using File > Open.

Once loaded, use the mouse to fly the camera around and orient the screen in a way that makes sense to you. You can also use the X/Y/Z view buttons to snap to standard views.

Note the cube marked by the red dotted lines. This indicates the work envelope of the machine, and no toolpaths or movements are allowed outside of this box (they will be stopped by "soft" limits).


3. Unlock and enable the machine

The machine is locked by default until you manually enable it.

First click the Emergency Stop button (red X), which should enable other buttons on the toolbar.

One of these buttons is the Machine Power button directly next to the Emergency Stop button. Click it to enable the system and establish a connection to the machine itself.

You may notice the machine jump slightly and start to hum - that means its alive!


4. Home all axes

Before the machine can understand how to move where you want it to, it needs to first understand where it is. We do this with a process called homing, which involves slowly moving each axis until it hits it's respective minimum endstop, at which point the machine knows for sure that the axis is at the 0 position.

You can home each axis individually using the Homing > [Axis name] options under the Machine menu. It is recommended that you start with the Z axis to get the spindle out of the way of any clamps.

Alternatively you can home all axes using the Homing > Home all option, which will automatically home each axis individually starting with the Z axis.

To abort the homing process at any time, either turn off Machine Power, or activate the Emergency Stop button.


5. Jog machine to desired origin on workpiece

Use the keyboard arrow keys to move the spindle to wherever you want the origin to be on your workpiece.

  • Move the X axis with left/right arrow keys.
  • Move the Y axis with up/down arrow keys.
  • Leave the Z axis all the way up for now.

If the machine is running too fast or too slow for you, check the movement increment in LinuxCNC or adjust the Jog Speed slider on the left side of the screen.


6. Align machine coordinates to workpiece

Although we've physically moved the spindle to where we want our job to start, right now LinuxCNC still thinks that the origin (0,0) is at the very bottom left of the spoilboard. This means that if you were to hit the "Start" button to run your G-code, the machine would run all the way back there to cut out your part!

To tell the machine that we want it to consider the current position to be the new origin we need to touch off each axis using the following process:

  • In the Machine control (F3) tab on the left, make sure that the X axis is selected
  • Click the "Touch off" button.
  • In the dialog box that pops up make sure that the value is "0", then click OK.
  • The screen on the right should update and move your toolpaths to the current position of the spindle along the axis you selected.
  • Repeat this process for the Y axis, but leave the Z axis alone for now.

7. Jog the machine around your job to check travel

With the Z axis still all the way up, use the keyboard arrow keys to carefully jog the machine all the way around your toolpath, checking to make sure that the movement is smooth and even and that there is no risk of the end mill, collet or dust shoe running into any clamps once they are lowered. Adjust the placement of any clamps that are in the way.

You can use the page up/down keyboard keys to move the Z axis up and down if you want to see where the various spindle parts at different stages of the job.


8. Run your job in the air to check travel

With the Z axis still all the way up, let's go ahead and do a test run of your job in the air to make extra sure that no problems will happen when the Z axis is lowered.

If your G-code has any retraction movements (negative Z values) in it, for example to cut out multiple, separate shapes, you may lower the Z axis an inch or so to give it some room. Just like the X and Y axes, use the keyboard page up/down buttons to move the Z axis to where you want it, then use the Z axis "Touch off" button to set the new 0 coordinate.

Hit the "Play" button to run your job, and get ready to hit the "Stop" button at any moment should anything go wrong.


9. Touch off Z axis to top of workpiece

NOTE: In order to preserve the spoilboard and extend it's life as long as possible, this step is critical to get right! If you measured your workpiece thickness accurately enough during your CAM setup, the spindle should not even touch the spoilboard (or just make very, very shallow indentations in it) when cutting all the way through.

Consider using another piece of material between the spoilboard and your workpiece so that the machine's spoilboard does not take any damage at all.

If running your job in the air looked good, you can now align the Z axis to your workpiece by using the keyboard page up/down keys. Use a relatively large movement increment when you're far away from the workpiece, then use a much smaller increment (like 0.1in) when you are getting close.

If you need to get it really accurate, try putting a piece of paper on the workpiece and moving the Z axis downward until you can just barely move the paper between the end mill and spoilboard.

In the near future we will have a more precise automatic Z height probe, but for now just get as close as you can!


10. Put on personal protective equipment

EXTREMELY IMPORTANT! End mills can break and be thrown long distances at high speeds. Protect yourself with safety glasses!

ALSO MUY IMPORTANTE! The machine tends to produce a constant, very loud, relatively high-pitch tone when cutting through material, which can fatigue the ears over long periods of work. Use ear muffs and take breaks to give your ear drums some rest!


11. Run your job

IMPORTANT! Put on safety glasses and hearing protection before running your job!

Check one last time for the following:

  1. Blue coolant should be flowing in and out of the spindle. If not, go back to the Machine setup step.
  2. The X, Y and Z axes should all be "touched off" so that the machine knows where your workpiece is.

If things look good, hit the "Play" button and be ready to hit the "Stop" or "Emergency Stop" button at any moment.

The spindle should spin up right away, then the machine will follow all of the toolpaths.


12. Monitoring, pausing and stopping your job

Once the job has started running you have a number of options for stopping it depending on why you want to stop.

If you want to stop the machine to check it's progress or because you don't like the toolpath for some reason ...

  • Use the Pause button to stop all axis movement and keep the spindle spinning, without forgetting our place in the G-code file. Use this when you just want to adjust a clamp or take a close look at something you just cut. Hit the Play button again to resume cutting.
  • Use the Stop button to stop all axis and spindle movement, forgetting our place in the G-code file. Use this when the toolpath is definitely not what you want and you just want to start over completely.

If there is some sort of catastrophic and/or imminent failure, like the workpiece coming loose, axis movement jamming, workpiece catching fire, etc. ...

  • Use the Machine Power or Emergency Stop button to completely turn off the machine and sever the connection with the computer. This will stop all axis and spindle movement, and may require the machine to be re-homed.