Creating a Lathe G code file

The basic steps to create G code for a profile to be turned on a lathe is:

  1. Create a Qcad drawing of the profile.

  2. Have the Arc Generator for Lathes as an External Tool in Gedit.

  3. Open the Property Editor in Qcad and doc it to the side bar.

  4. Click on each entity and use the data to create your G code.

Make a drawing of a profile

  1. Open Qcad and if the Property Editor is not visible go to View > Property Editor. Dock the Property editor in your favorite place.

  2. Draw the part as if you are sitting on the spindle and looking down on the part with the tooling side on the right of the drawing.

    images/lathe01.png
  3. In Gedit start a new document and click on Tools > External Tools and what ever you named the Lathe Arc Generator. Make sure your cursor is on the first line in the document then click Send Preamble in the Lathe Arc Generator.

    images/lathe02.png
    images/lathe03.png
  4. Save the file in linuxcnc/nc_files as lathe01.ngc

  5. Add a tool if your lathe needs one with T2 M6 G43

  6. Add a rapid move to the clearance point of your start move. Click on the entry move in Qcad and note the Start Point in the Geometry of the Property Editor. The Y: is the Z in a lathe.

    images/lathe04.png
  7. Add a feed move to the end of the first line with G1 X0.000 Z-0.100 F25.

  8. Add a second feed move to the end of the second line with G1 X0.100 Z-0.100

  9. Skip a few lines and add a M2 so the program will load without errors. Put the cursor at the blank line after the rapid move.

    images/lathe05.png
  10. You should be able to load the G code in the Axis Lathe Simulator without errors.

    images/lathe06.png
  11. Click on the first arc in Qcad and using the info in the Property Editor with the Lathe Arc Generator create your first arc.

    images/lathe07.png
images/lathe08.png
  1. Click Send Arc and the arc is sent to the Gedit document.

    images/lathe09.png
  2. After each insertion of G code reload the file in Axis to test the validity of your addition.