Visit the forum instructions to learn how to post to the forum, enable email notifications, subscribe to a category to receive emails when there are new discussions (like a mailing list), bookmark discussions and to see other tips to get the most out of our forum!
Help needed: Improving conversion of DXF to G-Code

  • Marcin has recently asked for help regarding the conversion of DXF files to G-Code for the open source CNC torch table:

    [...] the above machine meets our criterion of simple design. Our goal is $2k for a 6×10 foot machine  comparable to industry standards costing about $40k. This requires toolchain integration of toolpath g-code generation and use with an open source CAM package such as LinuxCNC. Our last experience with the tool chain was messy, so if you are a Python programmer, help us integrate existing modules into a killer Open Source CNC Torch Table Control Software package. See previous work here and referring page here. Considerations include height control feedback integration, piercing strategy, and tool width corrections.

    Vann created a PHP script that reads the output of dxf2gcode and makes some changes to it, as explained at

    As it stands, the toolchain for open source torch cutting is quite disintegrated. It turns out that the above code, while in principle correct, does not address the practical considerations of piercing metal. For example, when one wants to torch out a hole - one should not pierce the metal right on the cutting line, because piercing is a messy operation. Instead, one wants to pierce inside a hole, and subsequently move to the circle contour. Moreover, one wants to preheat the metal not by standing in place, but oscillate back and forth to heat the metal more evenly.

    It further emerges that the fuel flow rate should decrease after metal ignition, as the fuel gas is important primarily in preheating, not in cutting.

    Moreover, the width of the cut needs to be considered, so the actual toolpath needs to be modified by about 1/16 smaller diameter size for circles when using a #2 cutting tip. Thus, finetuning is a precise matter - if one is interested in precise cuts such as small bolt holes.
    To address the proper piercing issue, Vann Miller has written a correction script. This script does 3 things.
    First, it takes out the z values generated by the DXF to G-code Converter (not needed in a 2-axis motion system at hand).
    Second, it starts a pierce by moving towards the center of a hole.
    Third, it rotates the torch around a small radius (.05") during preheating. The number of rotations is currently 8, but one should be able to modify this.

    A better approach could be to implement these changes as options for dxf2gcode.

    If you know Python and you want to help, please clone the source code of dxf2gcode from our Mercurial repository at (or simply download the source from

    Then, take a look at the first issue we need help with:

    One message from dxf2gcode's dev mailing list ( suggests that we use this branch as a starting point:


  • 12 Comments sorted by
  • Vote Up0Vote Down
    December 2011
    G code conversion should be done with the driver software of the board for best results.

    My torch table driver uses dxf files directly and converts them to gcode. The problem with your table is that we don't know how far each axis moves when one step is triggered by the driver, also we don't know other essentials such as the kerf.

    You also have dwell time and pierceing that have to be implemented, this is normally handled by the driver.

    Seems like there is a lot of reinventing the wheel in this project.
  • Vote Up0Vote Down December 2011
    I would like to help with this if you can provide specific requirements of what needs to be implemented. I've also messaged you on bitbucket and on skype. Hopeful we can get in touch via a more interactive medium than this forum.
  • Vote Up0Vote Down
    December 2011
    I have a freeware dxf to gcode program around here somewhere although it has to be tailored to the individual machine. 

    I was going to go the DIY route with my torch table, but after doing the math I went with a already built system for a couple grand more cause of the tech support and less headache.  Cant afford to waste time and money on a unproven table design when I got a family to feed with it.
  • Vote Up0Vote Down
    December 2011
    see this for a list of DXF to gcode programs.  some are demos but will do up to 250 lines

    see here
  • From working with 3D printers I've grown to appreciate the useful difference between a dedicated control board with tailored driver software and the general-purpose host software that outputs general-purpose g-code.

    I'm not much of a programmer, but I suspect you could take something like replicatorG (under active development for Makerbot) and help add features to improve its ability to control a plasma table, rather than start from scratch. This will also pay dividends later when you want to control CNC routers and 3D printers. You might as well have one host program that simply interfaces with dedicated control boards for each one.

    Skeinforge, which was incorporated into replicatorG, has multiple toochains only one of which is for 3D printing.
  • Vote Up0Vote Down
    January 2012
    here is a driver download for dxf to gcode, although this particular driver does not rely on the computers timer to make the steps work, it uses the timer inside the control box.

    this might help

    I know torchmate will sell just the control box by itself which is a tested design used commercially.

    This will gain you customer support, and continued development on the software side.  In addition you can use a lower powered computer due to the timer issues addressed above, and it is USB connected. 

    I went with Torchmate myself because they have the unlimited free customer support, and if you go on youtube, there are hundreds of videos of their machines in operation which means that they turn on and work as advertised unlike some CNC machines that work one day and the next they wont.  That was a big hassle in the large format inkjet printing and sign industry that uses the same CNC methods.

    the Reprap software is good, but there is not much experience scaling it up yet to large formats.  When you go larger size you also tend to want faster speeds which can cause issues with slower controller boards.

    Large format controllers you can scale up pretty easy to 300 inch per min speeds, change the cornering characteristics like slowing down in corners, changing acceleration depending on the shape being cut to match the torch cutting pattern,  which require a large number of steps in a fast speed.  Whereas the controllers for the smaller boards can get overwhelmed by the sheer number of steps and actions being demanded because the board cant handle the amount of data.  It is like trying to run windows 7 on a 1ghz machine from 2001.

    My machine can handle 10,000 lines of G code pretty easy and digest dxf files with 40,000 nodes.  It was a concern at the beginning when I first got into this, is will my machine be able to cut a complicated file like a Persian rug design in steel.  Several years ago I tried to get this design cut at a commercial place with a older machine and they were unable to run the file because it was just too big.

  • I emailed Vann earlier today to ask for a copy of the PHP code linked to above since all the links I found were broken now. I'm attaching a Zip that contains that code and some notes about the code and discussions Vann and Marcin had about this problem.

    The question is, does this problem still need to be solved? If so, I will take a look at it in the near future. 
    Attachments 3K
  • After installing EPD 32 bit and some small modifications in the example code, numpy instead of numeric I managed to get the examples working so far. As your post dates back to 2011 could you update on what is needed now as I might be able to help as I am kinda familiar with python codes. (I build my own applications in this language although it is in the section of biology thus something completely different)
  • I'm new here, but I have done a bit of CNC machining. Unless I'm missing something, it seems that a dfx to g-code converter is being sought that also takes into consideration the cutting characteristics of the particular machine being used. I tend to look at this a bit differently. Usually I draw out the part features then the tool paths with consideration of the roughing, spring and finish characteristics. Then I convert the tool paths to g-code. This puts the thinking bits of the operation with the designer/operator. In my opinion, it can be as difficult to cajole a "smart" converter into giving you what you need, as it would be to just figure it out and write the code by hand. In the plasma cutter scenario, which I have no real experience, I would tend to have a different file for each common task, such as a piercing procedure, then maybe a lead in procedure. I would then copy, edit and paste the subfiles into the main part file. Or, I could be all wet.

    There should be some folks on the LinuxCNC mail list that have first hand experience with plasma cutting.

    Kirk Wallace
    California, USA
  • There has been open source work for CNCs in the node.js community. In this presentation, tmpvar built one that can handle 2'x3' for $1.5k
  • A program that converts DXF to GCode is great, but only necessary for intricate designs.

    It is my opinion that too much effort is being misspent on this.  What FactoreFarm needs right now, is a machine that can cut perfect circles, strait lines, and possibly ellipses or arcs.  *These basic shapes do not require DXF files* GCode can be calibrated and hard-coded for each cut.

    Please don't get me wrong, i want to see a DXF to GCode script or program. But, other parts of the GVCS need attention, and our primary goal should be to get the Torch Table moving &cutting. even if it's with an Oxy-Acetylene torch it would still be a very useful tool right now for FeF.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion