Close
0%
0%

PCB Isolation Routing Software

Convert Kicad PCB files into GCode with isolated PCB Nets

Public Chat
Similar projects worth following
KICAD PCB software produces tracks geared towards printing. Milling the resulting tracks is neat but wasteful. This software creates a path equidistant from nearby tracks. This is done using Voronoi line segmentation.

Each track is colorized and dilated. Track dilations continue until they meet. The resulting edge between the two dilations is the isolation contour path. The contour path is then converted to Gcode. Appended to the final Gcode are drill holes, which maintain original sizes.

Details
The software process Kicad 5.2 PCB files into gcode.

Usage more on Github site - https://github.com/micsche/kicad-laser-min

Usage: kicadcontour <options> <filename>

filename :- kicad pcb output file.kicad_pcb

  • -m (don't do conversion to raster but use map.png directly)
  • -f  process front layer of PCB (defaults to Bottom Layer processing)
  • -p (change pxmm scale conversion)

Files Created

  • map.png - Vector to raster conversion
  • cpp_image.png - wall paper art of your PCB
  • trace.png - Edge detection image
  • kic.gcode - Final Gcode

Vector to Raster conversion

Raster to conversion is done using  pxmm scale (pixels per mm). The resulting image map.png is then processed to create the isolation routing paths. pxmm default is set to 30. The scale is modifiable, however smaller pxmm reduces precision of paths created, whereas larger pxmm increases time to process.

Gcode Creation

The paths are converted to gcode using a path following algorithm in OpenCV.  Gcode is scaled back to original dimensions. Drill holes are appended to the gcode, using the original scale.

Errors

OpenCV contour following does not always make close contours. However, the gaps (at a pxmm of 30) are very small (in the region of 0.05-0.08mm). The tool width is larger than that, so it should not pose any problems. However, please comment on improvements.

OpenCV contour following also creates some small artefacts. However, these are not visible, but might have a minor impact on milling times.

Recommendation

I always optimize gcode before milling. This reduces unwanted travel time. I usually use https://xyzbots.com:4000/gcode-optimizer/

  • Small Partition issue solved

    Michael Schembri09/13/2020 at 11:09 0 comments

    Small partitions were left out of final gcode. Issue solved, however small artifacts remain as a result.

  • Ammending

    Michael Schembri09/01/2020 at 20:04 0 comments

    Update 1: Front and Bottom Layers are shifted and rotated accordingly. So they are always facing PCB side up.

    Update 2: output gcode is now into appropriate filenames "front.gcode" and "bottom.gcode".

    Update 3: Program cleans up after exit, unless you tell it to.

    Update 4: Included "makefile". Now all you need is to type in 

    make 

    in the directory.

  • Parallelizing Operation

    Michael Schembri08/17/2020 at 08:30 0 comments

    Tried parallelizing the dilation operation (the one which causes most delay), this weekend.

    Using openmp on loops. But have no control on area segmentation.

    #pragma parallel omp

    Tried segmenting the area in four. Although, I get the same track results, the background is not filled up entirely. Need to investigate more.

  • Oval Holes

    Michael Schembri08/12/2020 at 13:22 0 comments

    Now holes can be  oval inside gcode.

  • Pad rotation

    Michael Schembri08/11/2020 at 12:34 0 comments

    Rotated pads and rotated footprints corrected.

  • Edge Cuts Handling

    Michael Schembri08/10/2020 at 20:58 0 comments

    Added handling of PCB with non-rectangular edge. i.e. it will handle edged cuts (polygon and circle).

    TODO: Edge Cuts (arcs)

View all 6 project logs

Enjoy this project?

Share

Discussions

Twisted Pair in my Hair wrote 08/12/2020 at 08:38 point

I've been doing exactly the same thing with Voronoi algorithm couple of years ago. Then abandoned all attempts to complete it. So cool that someone did it properly!

  Are you sure? yes | no

Michael Schembri wrote 08/12/2020 at 13:23 point

Lockdown project :)

  Are you sure? yes | no

Twisted Pair in my Hair wrote 08/12/2020 at 21:33 point

It's all about isolation :)

  Are you sure? yes | no

Ken Yap wrote 08/01/2020 at 09:00 point

Nice, that's a very logical thing to do for milling.

I wonder if the algorithm could be used for boards destined for etching to create blobby tracks like from the early days of hand drawn PCB patterns.

  Are you sure? yes | no

Michael Schembri wrote 08/10/2020 at 21:01 point

Hehe :) 

Can't imagine why would one do that with kicad?

  Are you sure? yes | no

Ken Yap wrote 08/10/2020 at 22:16 point

Just for old times sake. :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates