Optimized Vinyl Cutting G-Code Tool Path with DXF2GCODE

G-Code (or RS-274) is a widely used protocol for CNC machines. I have added vinyl cutting capabilities to the Shapeoko desktop CNC recently (see DIY Vinyl Cutting Drag Knife for Desktop CNC), however cutting vinyl with a drag knife is whole different story compared cutting materials like wood or aluminum. As with many other things, it is about handling all corner cases properly.

Expected and not expected results cutting vinyl

Note: the above picture does not show the ideal result to be achieved. More about this later in this article.

The advantage of drag knifes for vinyl cutting is that the blade can rotate freely and the head does not need to turn. To make this work, the knife has an offset to the center of the drag knife blade holder:

The offset allows the blade to turn while the head is moving. Obviously it is a bad idea to move the head in opposite directions. So ideally the moves are smooth and no sharp corners, because with corners the concept has a problem. So what I can do is simply avoid corners and round them instead. Of using a design not having corners like the one I used in one of my first projects:

But obviously this does not work well if I want to have corners. Even more, the corners will not be correct by that offset if the tool path follows the line:

Tool and Cut Path

The solution is to modify the path with small ‘swivels’ like this:

Toolpath with swivels in the corners

Adding this swivels by hand is complicated: there are ways to add this with an Excel sheet, or one has to buy tools like Cut2D Pro which do that tool path optimization.

But actually there is an open source tool which helps: dfx2gcode

dxf2gcode is a very useful open source program available on SourceForge to translate dxf (Drawing Interchange Format) into G-Code.

dxf2gcode on SourceForge

Let’s check it with a star shaped cut: Below is a small star created in Inkscape and then saved as .dxf file.

Test star in Inkscape

I have then cut star

In dxf2gcode open the file with the menu File > Open:

Configure your machine using the menu Options > Postprocessing configuration:

Postprocessing options

For my machine (Shapeoko) I had to remove the M3/M8 and M9/M5 codes (no need for cooling and Carbide Motion does not like multiple commands on the same line):

Removed G-Codes for Carbide Motion

Configure the machine with using the menu Options > Machine Type > Drag Knife

Add a tool using the menu Options > Configuration > Tools Table. My knife has on offset of 0.25 mm, so enter this as ‘diameter’:

Drag Knife added as tool

Assign the tool to the shape with the desired cut depth and feed rate:

Tool assigned

Now you can see the swivels added to the toolpath:

Swivels added to Tool Path

Note: If you don’t know about it: Camotics (see links at the end of the article) is a great tool to follow and simulate a tool path.

Simulating tool path with Camotics

Because Carbide Motion did filter out standalone F (feed) G-Codes (see this forum entry), I worked around this with adding feed codes to each move code as below, with commenting out the original feed rate change command:

G-Codes with Feeds

Finally, use the Menu Export > Optimize and Export Shape

Export G-Code

Then run the code on your machine.

CNC with Drag Knife for Vinyl Cutting

I did on my machine, and the result was interesting:

Red (no swivels), Green (with swivels)

There is not much difference, only that the start on the left is about 0.5 mm smaller as expected. But the corners still look ok because of the small 0.25 mm delta. The corners were not as sharp as they should.

So I tried something else with different angles and sharp corners:

Star with sharp corners

And here the added swivels paid off:

Without the optimized tool path the one on the left was not able to turn properly the knife properly, tearing off the vinyl. While with the swivels and optimized tool path on the right the sharp-edged star was cut-out pretty good. The outer corners were fine, but the inner corners were still somewhat round and not well aligned:

Not perfect because I noticed that the head was not as rigid as it should, because I did not tighten up the screws enough :-(. Fixing that and slightly increasing the offset to 0.3 mm fixed that, with a much better result:

final result

Summary

Vinyl cutting with a CNC seems straightforward, but there are lots of details to consider for good results. Starting from the knife cutting depth, proper machine calibration and a rigid head.

One of the most important things for vinyl cutting is to have a proper and optimized G-Code path to compensate for the knife offset. A small detour or swivel can make a difference. Fortunately there are open source tools like dxf2gcode which can solve that problem. Using that, perfect results can be achieved getting sharp corners cut out.

Happy swiveling 🙂

Links

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.