DXF2GCODE tutorial

This is my attempt at a quick tutorial to use DXF2GCODE with Maslow. It seems that DXF2GCODE is quite popular for CAM, and my brief dabblings with it show great promise. At the time of writing I have not yet run the output from DXF2GCODE on our Maslow, but I am writing this for my future self (and others) to refer to. If I have overlooked something or made any errors please post a followup message here.

Also, I only know how to do cuts. Pocketing and drilling are arcane mysteries at the moment.

First, get the software. You can find it on SourceForge here:

The workflow is:

Some DXF file -> DXF2GCODE -> G-Code file

Obviously, once you have the G-Code file you can load it up onto the Maslow. Yay!

The other thing is you can use your favourite CAD software to make the DXF. Double yay! I am mostly using QCAD, but I have also used OpenSCAD to make a 2D projection of a model, which can then be exported as DXF. The workflow expands thus:

Your favourite CAD software -> DXF file -> DXF2GCODE -> G-Code file -> Maslow

So, assumptions:
Assumption 1: You have a DXF file and you know what elements you want to cut (and whether you want to do an internal cut or external cut).
Assumption 2: You know what kind of tool you have on Maslow, and that it is set up so that Z=0 is the top surface of the workpiece, positive Z is above the workpiece (for safe moving) and negative Z is below the surface, cutting into the workpiece.
Assumption 3: You know the best feed rate for your tool and material, how thick the material is, and how deep you want to cut each element.

Letā€™s look at the software. I am going to ignore the menu functions I havenā€™t used. Along the top we have File, Export, View, Options and Help.

File|Openā€¦
Open the DXF file.

Export|Optimize and Export Shapes
Export the shapes into a G-Code file (usually ending in .ngc)

View|Show Path Directions
Make sure this is ticked

Options|Machine Type|Milling
Make sure this is ticked

Options|Automatic Cutter Compensation
Make sure this is un-ticked. Maslow does not recognise G41 and G42.

Options|Configurationā€¦
Configuration settings. Most can be left as default. I changed the ones below:

  • Machine config
    Third axis defaults
    Retraction coordinate: 5mm
    Safety margin: 3mm
    G1 feed rates
    First and Second axis (2D plane): 700 mm/min

  • Tools table
    I edited tool 1 to be diameter 6.35, speed 6000, start_radius 0.00
    I deleted the other default tools.

The config file is stored in username/.config/dxf2gcode/config/config.cfg
Itā€™s possible we could make a generic one that is ready to go for Maslow, and a Maslow post-processor, but for now, these are the only changes I made from the defaults.

Using the software
File|Openā€¦ open your DXF file. It will be drawn in the window on the right. Since you have only one tool defined (tool 1) then all cuts will have that tool selected.

On the left is a tabbed panel (Entities and Layers). Choose Layers. Click on the checkbox to deselect layers you donā€™t want, leaving only the layers containing elements you want to cut. You can also collapse the layers so that the list looks less cluttered by clicking on the tiny triangle at the very left of the layer name.

Now the window on the right will show only the elements you are going to cut. If there are extra elements there that you donā€™t want to cut you can deselect them in the list on the left.

Next to each element are two arrows. The blue arrow shows the approach direction and start position of the cut. The green arrow shows the exit from the cut. The arrow direction will help you apply cutting compensation (left or right) to account for the radius of the cutting tool.

Click on each element in the right hand window. The corresponding shape will be indicated in the list on the left, and the details of the cut will be shown below the list.

Again, because you only have one tool all of the settings will be pre-filled.

You can multi-select objects with Ctrl-click, or dragging a box around a group of objects.

For each object, check the settings for the cut (specifically the Z final mill depth). You can do a partial thickness cut, or full thickness cut. The software will calculate how many passes are needed, based on the Z Infeed depth setting.

Once you have selected an object or group of objects right-click on them to bring up the context menu. The only one you need is Cutter Compensation. You can specify G40 No Compensation, G41 Left Compensation and G42 Right Compensation. Because Maslow doesnā€™t support these commands and we turned off automatic cutter compensation the software will generate a toolpath which includes the desired compensation.

Thatā€™s it!

Click Export|Optimize and Export Shapes. The software will make an .ngc file for you.

I have not tested this file on Maslow yet, but I donā€™t think I have missed anything to get to this point. Again, if anyone spots any obvious mistakes, or can add clarity or further information please post here or PM me.

4 Likes

Can you add tabs? Or does that have to be done in cad software?

Iā€™ll say yes, because itā€™s described here:

https://sourceforge.net/p/dxf2gcode/wiki/LayerControl/

ā€¦but I havenā€™t tried it. Also, I donā€™t know if you can only do this by naming your layer ā€œBREAKS:ā€ or if you can specify a tab layer in the software. A similar method is used to specify drilling. Pocket operations are being worked on, but not currently supported as far as I can see.

I can see the appeal of having specially named layers, because it means all of the context for the job is in the DXF file, but if you canā€™t name the layers it would be nice to be able to specify for any object ā€œthis is a cut, to the left, right or centreā€ or ā€œthis is a drill point, just drill it to this depthā€, or ā€œthis is a pocketā€, or ā€œthis cut should have tabs on itā€. I literally discovered the software yesterday, and itā€™s perfect for a lot of the jobs I want to do, so I want to make it work. Very little on the web discussing DXF2GCODE and Maslow.

The other thing I have to figure out is why ncviewer wonā€™t display the final G-Code.

I might have some time tomorrow to run a job on our Maslow. If it works Iā€™ll worry about the details later. If it doesnā€™t Iā€™ll figure out why first. Thanks for replying to the thread.

1 Like

Can you upload the gcode? I have a couple of viewers to check it.

Thanks. I sent you a PM.

Iā€™ve figured it out. DXF2GCODE adds a blank/space behind x/y/z/i/j.
Ncviewer canā€™t deal with that, other programs (including GC) can.
Here a screenshot showing the small arch after removing the blanks.

2 Likes

Should this tutorial be in the Wiki category?

Sure, why not? Itā€™s not quite finished, insofar as itā€™s not a detailed tutorial, just a collection of notes.

Can I move it myself, or is that an administrative action?

And for those who are eagerly anticipating the resultsā€¦

It works!

I cut two small jobs on the Maslow and uncovered two problems. First, the width of the piece was not what I expected. About 2mm short. I need to find out if I drew the wrong size, or if I drew the right size but the cut did not match what was requested. Second, I got the Maslow to cut the ā€˜backā€™ of my panel, so I could get it to cut rebates into the back. The ā€˜frontā€™ of my panel is the side away from the cutter (flat against the spoil board). Naturally, since I am cutting from the back I should have mirror-imaged the panel so that things line up with the sub-panel when everythingā€™s assembledā€¦

This is why we cut on scrap material while we are figuring things out.

This could also be a problem with the system calibration. check tht the g-code
is right, but itā€™s far more likely to be the calibration than the g-code for a
2mm error.

David Lang

Thanks, I think youā€™re right. My CAD drawing is sized exactly as I want it, but the workpiece comes out about 2mm short on 146mm width and about 4mm long on about 80mm height.

I seem to recall the accuracy being much greater in the past, so Iā€™ll check the calibration. When we cut the sled it was precisely right in the vertical axis (18") and about 1/16" short in the horizontal axis.

itā€™s going to vary a lot depending on where you cut, the errors are not linear.

David Lang

Yes, I know. I was cutting in the centre, about 1/3 of the way down from the top.

Is there an easy way to reset the calibration without going through the whole calibration process?

@ame I did some testing a while back with dxf2gcode and thought it showed a lot of potential, especially if you could create Layer templates to use each time you start a new design.

Each layer specifies an operation and you can pass parameters to each layer, such as depth, tool size, feed rate etc.

Here is an example in LibreCad

and then the resulting toolpath in dxf2gcode.

Here are the files from the example, The dxf from LibreCad and the resulting toolpath from dxf2gcode.

millDrillTabTemplate_b.dxf (20.7 KB) millDrillTabTemplate_b.ngc (4.3 KB)

1 Like

Well, I think the CAD/CAM Software Tips category is appropriate as well. The other option is to let this discussion percolate a bit, and then use the best bits from it to make a wiki entry.

Thanks for this. Frankly I donā€™t know why Maslow users arenā€™t all over this. Itā€™s like MakerCAM, but it doesnā€™t need Flash, and it is deliberately simple. Even complex jobs could be done, but to be honest I just want edges and depths. And I want to use my favourite CAD package to make the designs in the first place. I didnā€™t really get on with FreeCAD, but I might revisit that later. QCAD is my program of choice right now, but it is not dependent on DXF2GCODE, nor is DXF2GCODE dependent on QCAD. This is as it should be.

I agree. Iā€™m hoping that a few more people try it out and offer suggestions or ask questions. Then the results can be summarised in an actual tutorial/reference.

Iā€™ve had a go at making a Maslow post-processor file for DXF2GCODE. Itā€™s quite simple, and really just consists of removing the codes that Maslow doesnā€™t recognise. The advantage is that I can call it ā€œMaslowā€ and it becomes visible in a list.

2 Likes

I went back an edited my previous post after I looked at the first gcode file I created in the CAMotics simulator and realized I had made several errors. First for tabs the layer needs to be named BREAKS also the DRILL layer works on points not a circle like I had previously drawn.

Layer Names look like this now in LibreCad.

IGNORE: ConstructLines
DRILL: 3 MillDepth: -6.1 ToolDiameter: 6.0 FeedXY: 300 FeedZ: 70
MILL: 1 MillDepth: -6.1 SliceDepth: 2.1 FeedXY: 300 FeedZ: 300
BREAKS: 1 MillDepth: -3 FeedXY: 300 FeedZ: 300

I retook the screenshots and uploaded the corrected files to my previous post. Re-ran the simulator and it now looks correct.

3 Likes

I am still having issues getting this to install on my pc. It gives me a message that I need some kind of run time environment. Can I just install and use? Other sites indicated installing python but I am unsure about that too. Please advise!

What OS are you on? This is pointing to a dependency, so no itā€™s not load and go for your system.

Thank you