vlachoudis / bCNC

GRBL CNC command sender, autoleveler and g-code editor
GNU General Public License v2.0
1.58k stars 534 forks source link

Open KiCad gerbers X2 and possibly excellon files. #1264

Open Harvie opened 5 years ago

Harvie commented 5 years ago

I would like to add support for opening gerber files, because flatcam does not really work with KiCad gerbers for me and i have to fix the g-code in bCNC anyway.

Opening excellon files might be option as well. Right now it's implemented as part of driller plugin #809, which is not really nice approach. I think we should be able to open it through open dialog and convert it to g-code like we do for all other file formats.

On the other hand excellon file format is deprecated as new version of gerber format called "gerber X2" also does drilling.

As a proof of concept I've managed to (kinda) convert gerber to g-code using this simple sed command. But it still misses some of the geometry:

cat baseplate-F_Cu.gbr | grep -v % | grep X | sed -e 's/[*X]//g;s/Y-/ /g;s/\(.*\)D01/G1 X\1/g;s/\(.*\)D02/G0 X\1/g;s/\(.*\)D03/\(D03 \1\)/g;s/ / Y-/g;' | LANG=C sed -e  's/\(......\) /.\1 /g;  s/\(......\)$/.\1/g;    s/Y-X/X/g' > test.ngc

There is interresting document on gerbers:

MARIOBASZ commented 5 years ago

I find this interesting, I will read it. I don't know about the existence of Gerber X2. Reading grbl directly can be an option? The piercing plugin is not bad either. Modifying so that with a single bit it generates the different diameters would be efficient.