DraftSight Professional: G-Code and CNC Machines

There’s a hidden gem within DraftSight Professional called the G-Code Generator. The G-Code Generator? What’s that? I hear you ask. Well, let me try to explain.

Simply put, G-Code is a computer language that tells your CNC machine how to make something. I suppose I better explain what a CNC machine is now. Well, a CNC machine is like a printer, except it doesn’t print to paper or card, it cuts or creates parts from a variety of materials such as wood, metal, plastic and so on… CNC machines are not exactly designed for the home, so they are generally only found in the manufacturing industry.

The DraftSight G-Code Generator allows you convert your drawing data to G-Code so that you can send the data to a CNC Machine. The DraftSight G-Code Generator can process lines, curves and arcs, if there are other entities in the drawing such as text, revclouds, splines and so on, it will ignore them.

The G-Code Generator supports generic G-Code, it does not have support for:

  • Arbitrary planes
    The only entities that are processed are those on the XY plane.
  • Custom post-processing for different CNC machines.

So, where can you find the G-Code Generator? Well, it’s located under the tools menu.

G-Code

Click on that and the G-Code Generator Panel appears.  It looks complicated, but if you open the DraftSight Professional help file, all the commands are explained in great detail.

G-Code

Obviously, if you are familiar with CNC machines and their software, then you should have no problems with the G-Code Generator and its functions. If you are curious to find out more about CNC machines, the different types and what they can do, click on this link and hopefully it will give you a better understanding: http://www.technologystudent.com/cam/camex.htm

Now, I know I said above that CNC machines are generally only found in the manufacturing industry, but there are many projects on the internet detailing how to make your own CNC machine. These are perfect for the hobbyist or small business in need of producing small etchings, pcb boards, metal parts and so on. If you have an interest in CNC, I would suggest checking these projects out.

The G-Code Generator might not be for every DraftSight user, but it is an excellent addition to the software. And, whilst I’m not a CNC expert (it’s not exactly my field of expertise) I am somewhat familiar with the process, and having spoken with people who use CNC Machines on a daily basis, they are excited by the DraftSight support for G-Code. If they are excited, then I’m excited!

Get the G-Code Generator and other productivity tools with DraftSight Professional, a powerful 2D design solution for professionals that includes productivity tools and an API for just $99.

www.DraftSight.com/Professional 

 

Featured image courtesy of Roland Josch / Public Domain Pictures
MJ Smyth
The first time I used CAD, it was on a DOS PC with an 8088 processor, 640K of memory and a Hercules Mono Graphics Card... That, well that was a long long time ago.I switched to DraftSight the day it was released and haven't looked back!
MJ Smyth

Latest posts by MJ Smyth (see all)

  • Johan Settersjö

    I have a lot experience from Licom Alphacam advanced metal 2,5d CAM. It is a very fast system when you don’t have a drawing file to begin with. Epecially suitible for old CNC milling machines which is time-consuming to program otherwise. An open source post processor makes it possible to tailor-made your CNC-program.
    How the G-Code Generator in DraftSight Professional works I haven´t figured out yet.

  • Brent Hannah

    I just purchase Draftsight professional, and as far as I can tell so far the Gcode generator doesn’t work very well (or at all). I can generate code on 2 or 3 straight lines, but anything more complicated than that it does nothing. No message, no timer, just … nothing. The reset zoom in the gcode window also does nothing. A little dissapointed so far.

  • Johan Settersjö

    Yesterday I updated to Draft Sight Professional 2017. The G-Code generator does’nt work at all.
    I want to engrave some text in a CNC-milling machine.

    1. I open my dwg file.

    2. I open the 2D G-Code Generator.

    3. I click the “Generate” – button.

    4. Command window: “Select one or more enteties” .

    5. I select the text, and right click.

    6. Command window: “Selected objects: 1” .

    7. Nothing happens…. -Why???

    Regards Johan

  • Hi Johan and Brent, sorry to hear that you’re having trouble with the G-Code functionality. To better help us understand this issue and find a solution, could you post this to our community in the iQuestions section so our experts can take a look? http://spr.ly/61818zFgc

  • Hi, I purchased the pro version because of the g-code option. First impresion: Indeed it seems to generate g-code. But it is rather creative with the Z-values. That is: it ignores the Z-values I implemented in the drawing with Properties->Geometry. https://uploads.disquscdn.com/images/76833bb4d981650ec3ce5d565dd2041ed689fdaf4d1801a9cab18d7effcb616d.png https://uploads.disquscdn.com/images/023f0eaea853de4557eb9e157419c83c5f48e38e1cc2710f016c279f8d5eaae1.png https://uploads.disquscdn.com/images/d7b178a3d994cd98f6f3daedaed84e8ceb09fc1f3b821dc044b0943ef9d1619a.png https://uploads.disquscdn.com/images/a580a0a64d9c6a720f5905742d64bb893ef3f0df5d744b5b37aaecc371ebb3e2.png
    The 3rd picture is what I get and the 4rth picture is what I would like tot get.
    Need help.

    • Marco Leizza

      Hi Japp, I’m Marco Leizza. User Experience for DraftSight. I would like to understand more about the workflow you are using when you use the Gcode tool and apply z values. For example, when do you apply the Z values in Properties?

      If you could give me a step by step process of your work flow, that woul be extremely helpful in me helping to improve the process.

      Much appreciated!!

      Marco Leizza

      DraftSight User Experience

      • HI Marco, thanks for answering. I need to mill a slope in CNC. It is simple really. A line goes from point A (x1,y1,z1) to point B (x2,y2,z2). Normally in 2D, z would stay 0 of course, but as I need to mill a slope, in my case z1=0 and z2=-2.0. That’s all. Fortunately in DraftSight you can change the z-values in Properties->Geometry. That is great, but when I try to generate g-code, that value is ignored and that’s a pity because the option to generate g-code directly from CAD is really brillant and for me makes Draftsight stand out, but it is not quite as useful as it could be. So what I would like is that every point is defined by x,y,and z value and not just by x and y. It would also be nice if the values entered in preamble and postscript etc…, would be remembered. Thanks for looking into the matter. regards, Jaap

        • Marco Leizza

          Hi Jaap,

          Thank you for sending me your workflow. You are correct that the G-code generator does not support an operation to cut a slope at this time. We will definitely consider that for a future release.
          I’d like to also provide information on how to control the Z depth. In your example, you are trying to control the Z from the Line Properties pane.
          The actual way to control the Z is inside of the G-code Generator User Interface.
          https://uploads.disquscdn.com/images/960177dceb9eb0801b2d7013d75a8a8e452dcec447a3cac67a45c9b5f40cd9dc.jpg
          https://uploads.disquscdn.com/images/a2184c8bcafdaa6ce5ab911840875e2aef27b39804dbda1e749904e58721e85e.jpg
          In the G-Code UI, you will see for “2D Tool path” and “Drill Cycle” you have options that control the depth as indicated with the red arrow.
          The depth is always going to be a negative value, as in…. -.5
          These values are measured from the bottom of the tool. For example, lets say you are using an End Mill. The value would be measured from the bottom of the end mill.
          If you gave a distance of -.5, then the end mill would plunge into the material to a depth of -.5.
          Hopefully you will find this useful, and if you have anymore questions, please do not hesitate to ask.
          Thanks!
          Marco

          • Thank you for replying Marco, I realize that we are dealing with 2D CAD here and that it is not a bug or so. I just think that a good CAD drawing app could turn into a great CAD drawing app if the Z-values of objects would not be ignored.

          • Marco Leizza

            Yes, but if you use the values indicated in the above images, that will give you control over the Z depth (with the exception of a slope). We will work on that.

            Thanks,
            Marco

          • Thank you

  • Massive

    I’m interested in this capability, but from what I hear you saying, it doesn’t do splines which is not a minor omission, it is the whole deal. Any boat, foil, or work of art has variable tension lines in it. Does it not handle any of that ?

  • Will Novotny

    In theory this would be a hidden gem, but the functionality is pretty limited at this point and I can almost write a program as fast by hand in a text editor. My main gripe is that it lacks pocket milling functionality, cutter comp, and that the 2D contour doesn’t even have the ability to increment down to the final depth.

    By offsetting the part geometry and sketching tool paths, it is possible to generate crude pocketing functionality and cutter comp of sorts. From here you can edit the text file and copy and paste the G-Code for the pocket a bunch of times and then go through and update the Z depth for every iteration to create G-Code for a pocket that would actually run on a CNC machine. Although it works, I find this disappointing because the repetitive tasks of generating basic tool paths and stepping down the Z height are exactly the sort of things that software is good at and supposed to do for us.

    This is probably an unfair rant, as the CAM function isn’t the main point of this software, but it is hard not to feel disappointed when there is so much potential to be great.

  • Wayne Bengtsson

    I’ve found the gcode generator to be little use, for my purposes anyway. If I create a toolpath, I need it to start and stop in the same spot, while following a continuous line. The code made describes the path accurately enough, but starts and stops in seemingly random order, which is useless when trying to program a flame cutting machine.

    There is so much to like about DraftSight, in my opinion, but the gcode generator is not one of those things.