Pcb2gcode not liking kicad gerber file

I want to mill a pcb that I designed in kicad using pcb2gcode. pcb2gcode showing error “Input geometry is self-intersecting” although I could not see any issue in gerberview.

Please see attached gerbview file:




And svg file generated by pcb2gcode (see screwed up track red rectangular box) :

Any solution to this problem or how to get rid of this situation?

I don’t have much familiarity with pcb2gcode but it would be a lot more helpful if you could provide the gerber, if possible, so that other people could try to reproduce the error and see what, if anything, in the original Gerber file is producing the error.

Also, there are other tools to produce GCode from Gerber files which you might want to look into to see if they fare better. One is gbl2ngc (disclaimer: I wrote gbl2ngc).

Good luck!

I used your gbl2ngc, this seems to be working well ( I need to compile it with a small fix on Mac OSX). Thank you for writing this tool. I was just aware about pcb2gcode. Can you please refer me some good gcode viewer for Mac OSX?

If you could make an issue describing the problem you had and how you fixed it on Mac OSX I would greatly appreciate it!

Note that my tool might “silently” fail and join those different regions that pcb2gcode failed on. You should check to make sure those regions are separated.

Though imperfect, the tool that I use to view GCode is is web based. Doing a quick Google search resulted in:

I also have one but it’s not very sophisticated. Mine is based off of joewalnes gcode-viewer which, unfortunately, is now defunct.

Note that these services might require you to upload your GCode to a central server (I know mine does) which might not be something you’re willing to do. Alternatively, since they’re all open source (including mine), you can download a local copy and run it yourself.

The wording of the error suggests that the ground plane polygon description has self intersections, either as is, or after/while the toolpath offsets are calculated.

The error may go away if you reduce the length of the parallel fat tracks that run in parallel with no ground pour between them, i.e. bring them in to the (?) header footprint at angles that leave tongues of copper between them.

Just my educated guess,

Erich.

In the zone properties there is an option to select polygone vs segmented.
Might be something to play with.

In answer to your question about macOS G-Code viewers, I have used both Afranche ‘G-Code Viewer 3D’ (available on the app store) and ‘Camotics’ (http://camotics.org) for viewing G-Code. I have mainly used them for reviewing panels and other light engineering designs rather than for PCB milling but I don’t see why they shouldn’t work for pcbs too. Best of luck - its quite fiddly milling pcbs!

@abetusk this was a minor issue compiler issue operator() for Gerber_point_2_cmp have to be declared const.

I checked gcode generated by glb2ngc online and it seems to be ok.

@erichVK5
Your educated guess seems to be correct, with some layout changes its looks like this:

I tried several other layout but only this seems to be working I don’t know what actually problem is, anyone please like to explain?

Thank @John_Patema
I will try these, meanwhile I setup a windows virtual machine and I am using flatcam and its working pretty good.
It seems CAM application on Mac OSX are not that advance yet.

In general, the tool path for any given copper feature to be electrically isolated by milling is defined by the outline of the feature, expanded by half the width of the tool being used for milling to result in a copper feature internal to the path that matches the design.

I suspect pcb2gcode generates a set of toolpaths for each feature, and then proceeds to test the set of toolpaths for intersection in excess of some threshold, to make sure each feature can be milled without adversely impacting on adjacent features.

Your track clearance, track spacing and track widths, located on a ground plane with possibly tiny fingers of copper between the tracks of interest, may be just on the verge of failing these intersection tests with the milling tool size specified, and the slight change you made allowed the generated toolpaths to pass pcb2gcode’s internal check.

Alternatively, pcb2gcode may treat tracks/pads/apertures differently to copper pour polygons (i.e. generate the offset path internally vs externally to the pour’s polygon outline) when generating the milling paths, and the self intersection error may relate the outline generated for a very thin finger of copper ground pour between tracks that ends up intersecting itself.

@Rene_Poschl

By default polygone was selected in zone property. It is working like a charm with "segmented zone property.
Thanks.