Search This Blog

Wednesday 7 August 2019

Simple workflow with DXF2Gcode

Now I have my proof of concept CNC machine running, a little, I need to learn how to get drawings in to a format that can be output to the machine.

For testing, I decided to use a pen instead of a cutter. I am therefore looking to do basic 2D profile cutting or plotting.

For flat 2D drawings, it is possible to convert DXF or SVG files to G-code.
The most common method, that I could find, is to use the free, open source, DXF2Gcode app.

Drawings with Inkscape
For use with CNC machines, it is either necessary to construct a drawing in an application, from scratch, or to convert a bitmap image to something usable for machine control.
The free vector drawing app, Inkscape can do either.

Inkscape, as I've said above, is a vector drawing application. That means it draws using mathematics to store the results rather than pixels. That's what makes it possible to use the output for machine control. Basic and complex shapes can be drawn from within the programme.

If the source is someone else's drawing which has been scanned or saved as a bitmap image, InkScape has an option to trace the edges of a bitmap to convert it to a vector based format, SVG.

G-code is the command structure used by CNC machines including 3D printers.
Some people create G-code instructions by hand but more commonly an application is used.

DXF2Gcode is a free programme for doing just that.

DXF is a file format commonly used by architects and engineers. It was made popular by professional tools such as AutoCAD. InkScape can save as a DXF file.

When saving DXF files from Inkscape, to be compatible with DXF2Gcode, I use the LWPOLYLINE option.

When importing in to DXF2Gcode from Inkscape, I found I had to turn off every other layer. This is because Inkscape outputs either side of a line as a separate path in the DXF file.

UCCNC control software
DXF2Gcode outputs as LinuxCNC Gcode. I am not using LinuxCNC, I am using UCCNC. I did get an error loading it in to UCCNC but it still looked correct on screen.

The above is a fairly quick and relatively easy method to create a simple 2D profile suitable for plotting.

When I change to using a cutter, I'll have to allow an offset for the kerf width. That is the size of the material removed by the cutter. That's another thing for me to learn about.


Shapecut Series:
Part 1 - Magic Eye to CNC
Part 2 - CNC proof of concept design
Part 3 - CNC controller enclosure


No comments :