Plot for isolation milling on the KOSY

Dear KiCad Community

I would love to use KiCad for the circuit design with my pupils, so that they can produce their own boards via isolation milling.

Unfortunately right now the plot function doesn’t seem to fit that. The plotting creates lines that prohibit connections between connected parts.

I already searched for this issues but only found really lengthy solutions like: Gerper Plot -> FlatCAM Gcode -> Gcode-ripper DXF -> Import in the milling Software.

At our school, we have KOSY milling machines, with corresponding software NCcad. In NCcad there is HPGL and DXF import possible.

I appreciate any help and am sorry, if this is the wrong place for my problem. Samuel

I have CNC milling machines, including a cheap one similar to the KOSY. Thus, perhaps the following will help…

I read info on the KOSY and NCad and see that it natively will run “NC” code.

NC is simply a file extension, just like .txt, .jpeg .stl… etc

It is a Text file containing G-Code with the .NC extension.

The G-code can be generated from many programs. For PCB’s, My favorite is CopperCam. You’ve discovered Flatcam, but, there are others, Including the ‘Path’ workbench in FreeCAD. I use that for engineering stuff I want to Mill.

Back to PCB’s:

I Export Gerbers from Kicad and load them into CopperCAM to generate the G-code.
I use the exported file (my mills can use a handful of file extensions and I most often use NC).

There isn’t much more to say as it’s simple enough.

Here’s a link to a video I posted for a similar CNC mill. Though the machine’s software is different, the process is the same (as in using CopperCam/others to generate G-code. And, yes, you can also hand code G-code in a text file, save as some_filename.NC and run it…

[EDIT] Added: Avoid using DXF for CNC. Thus, in Kicad, Plot ‘Gerbers’ and use them in appropriate G-Code generating sofware.

Same here.

PCB milling is a niche application, and mostly done by hobbyists, or by people who need prototypes really fast ( (half) an hour or so).

The hobby market is usually served by applications like Flatcam and Coppercam (which are probably the most popular) while the extremely quick turnaround prototyping business usually has custom software that drives custom hardware. lpkf used to make such machines.
https://duckduckgo.com/?q=lpkf+pcb+router&t=h_&iax=images&ia=images

Thank you for your replies!

Unfortunately the KOSY uses some dialect in their .nc gcode. See discussion here at FreeCAD.
I don’t see how i can support this easily with FlatCAM.

Out of interest: why should avoid .dxf files cnc?

Consider this:

Like most CNC machines using Gcode, they generally meet the standards of basic G-commands

They may add specific’s for their machine to recognize (stuff in the file’s header). But, many will run the code.

Sometimes users will edit the file and add (copy and pasted for one of the files the machine does run).

For a Test: Try the attached file and report back.

Why ‘Not’ use DXF? Well first, because it’s giving you trouble. Second, because it’s a hacked way of doing it.

EDIT: Oh, and the Path workbench in FreeCAD enables uses to select various g-code format structures. Can try different one but, they mostly simply do different things in the Header… The Gcode moves/controls are still mostly the baseline code.

Track1.nc (1.4 KB)

1 Like

From your link it looks like the KOSY uses some weird G-code for tool changes, feedrates and spindle RPM, but you’ve already got a few snippets of Python to “fix” that, and it should not be too hard to integrate that code into a standalone script that reads your generated G-code, modifies it, and writes it to a file again.

The best way to fix it would be to ask the manufacturer of KOSY for better compatibility for their software.

Another possibility is to simply replace the brains of your KOSY with something that understands GRBL or Smoothieware.
I have a homebuilt CNC machine and put GRBLhal into an EUR6 We-Act “Black Pill” (STM32F411CEU).

Why would you want to avoid .dxf?
Try out some programs (CopperCam / Flatcam / FreeCAD Path workbench / etc) and make some comparisons before you settle on a workflow, and then just stick with whatever works for you. I would start with something that understands Gerber though. Gerber is the default format for PCB’s, while .DXF has never been a very robust or extensive file format. For example it does not have embedded units, so you don’t really know how big things are.

Quick Followup…

Not suggesting you use FreeCAD for PCB milling (I don’t) - just pointing out that different Gcode formats are part of the Path workbench.

Try some different one’s via the list shown…

Screenshot

Thank you very much for your help.

I see, there are some ways to achieve my goal.

Unfortunately I think those ways have too many steps for a successful use in school contexts.
Every extra step is a obstacle for less talented students.

  • I am looking into flatcam if I can establish an easy workflow.
  • Do you have hints how to get the layout from KiCad into FreeCAD for the milling process?

Best regards!

Re: Using FreeCAD to mill PCB Traces and Pads.
That would be the very best way to Confuse and Frustrate any student (and teacher). There are too many shortcomings that require knowledge and problem solving (not to mention Crashes).
And, there are no tools/features to tweak them beyond tweaking as you would other objects.

But, you can use the Stepup workbench to load Kicad PCB’s and Traces/Pads. Sometimes is works great, usually (not) but, that does depend on the details of the PCB and your FreeCAD pref’s setups.

Once getting the traces and pads into FreeCAD the Path workbench can mill them (after too much setup work… it’s Free so, try it)

Re: Flatcam

There are folks that like Flatcam. I don’t. Thus, not able to help you.

For me, the Simplest, less Frustrating and Most Straight-Forward Useful Toolchain is:

  1. In Kicad, Plot the Gerbers of the Trace layers and Edge_Cut.
  2. Using CopperCam, load those layers
  3. Set the milling and export parameters (one time is good for all PCB’s with similar aspects (speed, feed, depth of cuts… And, you can setup the parameters for your KOSY mill)
  4. Run the milling/machining process and save results (.NC file)
  5. Load the .NC file into your CNC mill and run it

The GIF video below shows those steps (there was no need to reset any of my parameters so, I just opened some panels to demo what some look like. Also, I did not save save the file but do show how to do it… And. I did not save the PCB board shape cut (to save video time/file size for posting).

I like Big pads so, all my Kicad parts use them and, thus, where needed, I either tweak them in CopperCam or, add a separator between them (as shown on two pads in video). Same process for tweaking traces…etc.

CopperCam has all the tools for tweaking pads/traces/holes…etc where as FreeCad does not. CopperCam has free demo usage for small PCB’s so, you can try it out.

Lastly, FYI: I run CopperCam on a Mac using Wine virtual machine…

1 Like

I do have a CNC machine, but as of yet I’ve neither used CopperCam nor Flatcam.

Because of BlackCoffee’s praise of CopperCam, I had a look at it’s website, and apparently it is a commercial program (USD80) with a limit for 25 contours in the trial version. It does not run on my linux box natively, and even under windows it disregards common install practice and does not install itself in “Program Files”
https://www.galaad.net/coppercam-eng.html

FlatCAM is an open source application and free to use. Once I had a short peek into the capabilities of FlatCAM, and it appeared to be a pretty capable program with lots of functions, but probably not easy to setup and/or use. I have a very strong preference for open source projects. I’ve donated more to open source projects then I’ve paid for commercial software. For me personally the choice would be on FlatCAM without any doubt, and I would only consider other programs if it proved unusable.

FreeCAD is not an easy program to learn to use. If your sole purpose is just a way to convert PCB line art to something that can be milled, then FreeCAD is probably not a good choice.

And there are also other choices:
https://duckduckgo.com/?q=cnc+pcb+milling+software&t=h_&ia=web

It is of course up to you which applications fits your goals and philosophy best.

1 Like

Follow up… until coffee’s gone…

Yes, it can be done in FreeCad and as mentioned, it won’t be easy, simple or of real use unless you/student’s like Torturing yourselves.

That said, I won’t detail the steps and in’s/out’s of doing it. But, after successfully loading board and traces and mucking about with extruding the traces/pads…etc, you can use Path workbench to get Gcode.

Video below shows only One trace (the left-most one) and simulation of Milling (in Freecad). I did not bother with setting correct Mill-Bit/etc…

Why force your students through this process at all? It’s not something they will ever use in professional life. Figure out a workflow and have them submit gerbers to you for processing.

Or better yet, just send them to one of the many dirt cheap fabs in China that will produce far higher quality boards in less than a week.

I have the tendency to agree with halachal.
Most PCB’s these days are full of small SMT stuff and these need pretty tight design rules, at least double sided and plated-through PCB’s. Having a decent solder mask makes soldering a lot easier, and the silk screen helps with locating what you should solder where.

When you mill your PCB’s you have none of these advantages. With small design rules, the milling will also need a fine point, and those fine points do not cut well. The center of a circle is always standing still, no mater what the RPM is.

Thanks again, for all your work and help!

I looked into the path workbench of FreeCAD some time ago and was surprised, that a lot of things are possible with that. But I think this is too much work for students.

Why should students run through this process at all?
The students feel enabled if they can go through every step theirselfes and are not dependant on their teacher doing some magic they can’t understand to get their design milled.

But the process right now seems like I will let my students just give me their designs and adapt the layout to the KOSY myself.

Milling at all? - Because we can provide the designs really fast.

Regarding KOSY

I looked into it a bit and discovered (as I anticipated) the Gcode would be very basic/simple.
One of the posted links clearly documents the minimal info required for the machine to run the Gcode. That info is posted here

I made a basic routine to do as shown below. It works on my 3D-3018 Mill in the Candle software.

I tweaked the file to Add the info from the site/link and it also loads fine in my control software. Hence, User can either add the couple of lines or, create a post-process file and (in CopperCam, point to it. So, no user involvement for this after setting it up…

Very simple and straight forward. The only caveat is I don’t have an example of a real file to ensure my added lines are correct (the link was a bit unclear… perhaps)

I suggest you load the file below and see what complaints/errors, if any. But, you can review the Link above and a file that works to get confirmation…

playing.KNC.nc (383 Bytes)

Delete the .nc if necessay (the info specs using KNC)

This is the code’s text:

06.19.2021
Your Name
; comments - use semicolon

M10 O6.1 ;230v ON
M10 O2.1 ;230v OFF
G76

N1 G00G90
N2 T10M06 ;( EM 0.8mm (1/32") )
N3 G00F50Z25
N4 Z3
N5 G01F50X5Y5
N6 G01F15Z-0.5
N7 G01X5Y5F100
N8 G01Y45
N9 G01X15
N10 G01Y5
N11 G01X25
N12 G01Y45
N13 G01X35
N14 G01Y5
N15 G01X35
N16 G01Y45
N17 G01X45
N18 G01Y5
N19 G01F50Z15
N20 G00F50Z25
N21 M02 M30

M10 O6.0
M10 O2.0

1 Like

Okay.

I will look if I can establish a postprocessor for flatcam to generate KOSY-nc files. Those should be able to load in the KOSY nccad software.

Thank you all for your help. I think it will need some time to test everything. But as soon as this is done, I will report my results here.

Best regards
Samuel

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.