Bitmap PCB to G-code for CNC
Forskningsavdelningen have been working on a new vectorization algorithm specifically designed for tracing PCB layouts, keeping CNC routing restrictions in mind to produce G-code that executes with minimal dwelling-requirements. This is a preview of stage-1 (vectorization) output of a sample input containing a large variety of potentially problematic designs:
The algorithm is complete, and now begins the work of writing stage-2 (tool-size correction) and stage-3 (g-code generation). The finished solution will allow autonomous conversion of any PCB bitmap image to G-code for tracing, drilling and outline milling. Output options will be one program per operation and drill-size, or a single program with tool-change operations.
Tweet
16 Responses to Bitmap PCB to G-code for CNC
Leave a Reply Cancel reply
Recent Comments
- jarmo on Bitmap PCB to G-code for CNC
- Nicola Lunghi on Bitmap PCB to G-code for CNC
- melhem on Bitmap PCB to G-code for CNC
Recent Posts
- We are still around
- Workshops: IT-policy för allmänheten – Redux 2014
- IT-policy för allmänheten - Del 2
- IT-policy för allmänheten - Del 1 beta1
- Workshop-series “IT security, for the public”
- Report from forsk monday at new hackerspace!
- Achtung Telia (pki debacle)
- Mail-liste-issues och Föredragsvisningar 3/3 @ Glassen
- Tre år efter razzian..
- Hacknight 4our, 19-21 October



Hi Guys!
I have done limited coding for PCB2GCode, and as you probably know, whats going on there is that the gerber files are rendered to black/white pixel graphics. Each seperated black object get a different color. Then some offsetting is going on, which is basically like a flood fill of a couple of pixels, either to compensate for the width of the isolation-milling tool, or to grow a voronoi shaped PCB (visolate style). Then there comes something like your step, but the outputed path still contains the pixel shape, and hence leads to very large gcodes, that are smoothed by the gcode G64 in the mill software: http://linuxcnc.org/docs/html/gcode_main.html#sub:G61,-G61.1,-G64:
Also, each islands surrounding is traced separately. This sometimes leads to some lines that are are done twice, or if voronoi is performed, all lines are done twice.
It would be nice if your algorithms were useable as a C/C++ library, because then PCB2Gcode could benefit from that.
Having continous pahts rather than “pixelated” paths should increase milling speed, and also quality, because I experimented with V shaped “gravierstichel” and the best results I got for low rotational speed and fast sidwards movement, with the only limit being the breaking of the tip at too low rotational speeds.
Do you have some more info on what you do? If you want to discuss, please mail me, kubicek gmx at,
[...] of [Forskningsavdelningen], a Swedish hackerspace, are working on software that will allow users to vectorize bitmap images in order to convert them to G-code files for CNC [...]
Can’t wait. Need a beta tester?
This sounds awesome. Can’t wait to use it
Looking forward to it! Especially when other people ask you to mill something, I seem to always get it as a bitmap and I have to manually convert to DXF.
Please keep us in the loop.
It looks great! I hope that it will be Open Source. What language you’re using?
How ’bout http://sourceforge.net/apps/mediawiki/pcb2gcode/index.php?title=Main_Page ?
@spe: pcb2gcode (at the time this code was written) produces a pixel trace - ie arcs are NOT arcs, rather tons of short horizontal or vertical lines.
This increases g-code size and the time required to mill the boards due to (de)acceleration required on sharp bends.
Since all bends are 90 degrees the files produced matches the worst-case scenario for this type of work.
A “dumb” machine with no (de)acceleration management will work better than a professional machine in this case, unless the professional machine also has smoothing (there is a G-code for that) but even with smoothing enabled, a properly designed file will still cut faster.
This was what this project intended to address.
Development was stopped, for no reason other than lack of interest. The code was not complex and basically consisted of a pixel tracer, just like pcb2gcode followed by an arc and line detection routine, followed by a routine to calculate the optimum curve/line parameters to match the input data.
Ah yes, and a drill hole detector was in there somewhere to generate tap drilling g-code. It was basically designed to find inner traced areas of roughly circular shapes.
These shapes were removed from the trace data, rounded off to the nearest available tool diameter and output to a separate file for each tool.
Hi “dude”.
I’m interested in your project. Is the source code available?
@Gus: no sorry, or… well I guess it’s somewhere on some compuler in some folder that I’ve forgotten about - but I really have no clue. Like I said though, the parts that worked perfectly were very simple (see above). The arc/line detection never reached a stable state. The whole code up to the point you can see on the screenshot took less than half a work day to complete and I’m pretty sure someone else could do a much better job.
[...] an image which you would like to mill with CNC? Most likely it is not in vector format. This software takes care of it – it simply takes bitmap image and converts it to vectorized G-code that is [...]
i really need this nice program
I really need this!!! also if it’s incomplete! please share some code on github!!!!
xx