Skip to content

IV. Generating the toolpath with FlatCAM

I decided to change my toolchain for milling my boards. I wasn’t happy with the one, I had described in the Electronics Production section.
I got all my informations, for the steps I’ll describe here, from this forum post
There are also very detailed descriptions about the FlatCAM options, Mill-bits and the cheap Chinese CNC machines.

*** The following screenshots show the old board layout. The procedure with new layout, is EXACTLY the same, as described below.***

Setting up FlatCAM

FlatCAM is available at it’s download page. I’ve downloaded the latest stable release for Windows

After installation and first start, we have to setup some things.

In the Options tab, make sure that APPLICATION DEFAULTS is selected.

I use metric values, so I changed the units to mm

Gerber Options

Isolation Routing

I use 0.4 mm end-mills, so I changed Tool dia to it’s value. For my V-Bits it should be 0.15 mm (see description in the above forum post about that)
I changed Width (#passes) to 2. It’s similar to the offset option in mods. (After milling I saw, that one pass is enough
I left Pass overlap by 0.15 and the checked Combine Passes.

Board Cutout

I use 1.0 mm end-mills for the cut out, so I changed Tool dia to it’s value.
I left the Margin at it’s default value. Gap size is a “support bar” that holds the pcb on place, when the cutout is on progress. I left it’s default values.

Non-copper regions / Bounding Box

I left it on it’s default.

Excellion Options

These options are for drilling the holes.

Cut Z is the thickness of the pcb-sheet. I’ve 1.5 mm pcb’s, so i changed the value to 1.8 mm to be sure, that the drilled holes, are completely drilled.
Travel Z is the travel height of the spindle. I changed that to 2mm
Feed Rate are mm per minute. As suggested in the forum post, I changed that to 90
Toolchange Z and Spindle speed are not needed for me. I left it’s default.

Mill Holes - Tool dia is for milling holes instead of drilling. My “standard” bit for cutouts is 1.0 mm, so I changed the value to that.

Geometry Options

This is where you put your defaults for isolation routing

Cut Z is the depth of cut, which I’ve set to 0.095 mm, as described in the forum post.
Travel Z is the travel height of the spindle. I changed that to 2mm
Feed Rate are mm per minute. I changed that to 100. I will increase that, after some tests.
Tool dia is again 0.4mm
I left the rest at it’s defaults.

CNC Job Options

I changed the Tool dia to 0.4mm and left the rest at it’s defaults.

Open the Gerber file

And choose the KiCad_Tutorial-F_Cu.gbr

generating isolation routing

In the Selected tab, I compared the settings, with the ones, I made above and changed them, to the same. With the Generate Geometry button, the routes will be created.

There’s one small piece, where my end-mill bit is to large to engrave. But this is okay here, because this is only the ground line.

Create CNC Job

In the Project Tab, we choose the new generated KiCad_Tutorial-F_Cu.gbr_iso

Back to the Selected tab, again, I compared the settings, with the ones, I made above and changed them, to the same. Additionally I activate Multi-Depth with the half of the Cut Z, which is 0.0475
That will make two passes, to mill to the defined cutting depth.

Finally I had to push the Generate button.

Now you can see the routes (blue) and travel lines (light green)

Export G-Code

In the Project Tab, we choose the new generated KiCad_Tutorial-F_Cu.gbr_iso_cnc

In the Selected tab is nothing to change and we can just hit the Export G-Code button.

I save the file in a new folder as 1_Isolation-04mm_2-passes.nc

generating Non-copper regions

We activate the KiCad_Tutorial-F_Cu.gbr file in the Project tab again and in the Non-copper regions section, we click the Generate Geometry button

Now we activate the new KiCad_Tutorial-F_Cu.gbr_noncopper file and go back to it’s Selected tab.

Back to the Selected tab, again, I compared the settings, with the ones, I made above and changed them, to the same. Additionally I activate Multi-Depth with the half of the Cut Z, which is 0.0475
That will make two passes, to mill to the defined cutting depth.
In the Paint Area I activated Seed-based (got better results in the preview) and hit Generate

Now I’ve to click inside an area where the copper should be removed. After a short moment, the ‘unused’ areas are painted with red lines.

A new file is generated KiCad_Tutorial-F_Cu.gbr_noncopper_paint.
And again…back to the Selected tab, compare the settings, with the ones, I made above and changed them, to the same. Additionally I activate Multi-Depth with the half of the Cut Z, which is 0.0475
That will make two passes, to mill to the defined cutting depth.
Finally I had to push the Generate button.

Looks good now…

In the Selcted tab of the new generated KiCad_Tutorial-F_Cu.gbr_noncopper_paint_cnc file, we push the Export g-code button.

I named the file 2_CopperRemoval-04mm.nc

Drilling (PTH)

Now comes the most interesting part for me…drilling holes.

I deactivated the Plots from the before generated files. That gave me a better overview.
Then I opened the PTH Excellon file KiCad_Tutorial-PTH.drl, which was generated in KiCad.

The holes are now marked on the board

In the Selected Tab, I defined the values as shown in the picture below. I chose a lower Feed rate from 60mm per Minute In the Tools Section, are the hole diameters, which comes from KiCad.
Now push Generate

A new File KiCad_Tutorial-PTH.drl_cnc has been created and in the plot are the new paths visible

In the Selected tab of the new generated KiCad_Tutorial-PTH.drl_cnc file, we push the Export g-code button.

I named the file 3_Drill-1mm.nc

Drilling (NPTH)

Normally I wouldn’t need the NPTH holes, but for practice, I’ll drill them, too.

So I opened the KiCad_Tutorial-NPTH.drl and open it’s Selected tab.
In the Tools window are now 2 hole diameters. So I have to make 2 cnc-job files.
First I changed the values in the Create CNC Job section as above. Then I marked the 1.0 Diameter hole and click Generate

Then I switched to the Selected Tab of the new generated KiCad_Tutorial-NPTH.drl_cnc file and push the Export G-Code button.

I named the file 4_NPTH-Drill-1mm.nc

I did the same with the 2.5 Diameter hole and named the g-code file 5_NPTH-Drill-2.5mm.nc

Cutout

I would like to try the FlatCAMS build-in “Cutout Generator”
(In the Output Devices section I wrote a workaround for milling custom edge cuts)

Back to the Selected tab of the main KiCad_Tutorial-F_Cu.gbr file, I changed the Gaps in the Board cutout section and hit Generate Geometry

Now there is a cutout with 4 gaps generated

Then I switched to the Selected Tab of the new generated KiCad_Tutorial-F_Cu.gbr_cutout file
In the Create CNC Job Section, I made some different changes !

Cut Z: -1.8
Travel Z: 2.0
Feed Rate: 90.0
Tool dia: 1.0
Multi-Depth: Check
Depth/pass: 0.45 !!!

After changing the values, push Generate

Now the plot looks like this

Then I switched to the Selected Tab of the new generated KiCad_Tutorial-F_Cu.gbr_cutout_cnc file and push the Export G-Code button.

I named the file 6_Cutout-Mill-1mm.nc

Now I have 6 G-Code files:

1_Isolation-04mm_2-passes.nc  
2_CopperRemoval-04mm.nc
3_Drill-1mm.nc
4_NPTH-Drill-1mm.nc
5_NPTH-Drill-2.5mm.nc
6_Cutout-Mill-1mm.nc

In that order I have to mill the board.

I don’t provide g-code files for download, because it can damage your machine !!!

But the Flatcam Project Archive can be downloaded HERE

*** The new file I have made without CopperRemoval and NPTH drill holes, because I do not need that. The new archive can be downloaded HERE***