DirtyPCBs.com - gerber output not useable by boardhouse

OK, just got message back from the nice folks at DPCB, that the boardhouse of theirs could see the drill data and the outline layer (*) this time around… looks like I got the outline layer modded correctly.

The plot settings I used for this:

plot format:

  • gerber
  • F.Cu
  • B.Cu
  • B.SilkS
  • F.SilkS
  • B.Mask
  • F.Mask
  • Edge.Cuts …modded
  • B.Paste (for stencil)
  • F.Paste (for stencil)
  • Exclude PCB edge layer from other layers
    gerber options:
  • Use Protel filename extensions
  • Include extended attributes
    default line width (mm):
  • 0.1
  • 4.6 (mm)

[drill file]
drill units:

  • Millimeters
    zeroes format:
  • Decimal format
    drill map file format:
  • Gerber
    drill file options:
  • none (DESELECT merging of PTH and NPTH)
    drill origin:
  • Absolute

*) originally the outline layer wasn’t visible to them, but after I modded it manually (adding a G74* command BEFORE every G01* command, except for the first one in the initialization area, shown below) the outline layer worked
[edit - I also deleted the extended gerber stuff at the front, before ‘%FSLAX46Y46*%’]:

G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
G04 Created by KiCad (PCBNEW (2015-08-16 BZR 6097, Git b384c94)-product) date 10/10/15 15:03:23*

further down there where some G01* which now are behind a G74* like so


Next would be to find out what the other layer files have/don’t have that they need. But not with this order… I need the boards.

Anyone care to chime in with experience?
Anyone who recently did a successful run with DPCBs (2 layer, etc.)?

If needed I can attach the board I did sent over there (sans some non-public circuitry) to this thread, just give me a yell.

I can also list github projects and boards order-able through their store there which are KiCAD made and work.

My current KiCAD is BZR6097.

I’ve had problems with the latest KiCad gerber exports and an old CircuitCAM program.

Now that I look at the older gerbers that worked, I see that they have G54 “Tool Select” whenever the aperture is changed.
However the newer Gerbers that are problematic omit G54 and just simply state an aperture such as “D10”

Older KiCad, proper Gerber:


Latest KiCad, hard to understand for CircuitCam (and maybe DirtyPCBs?):


The test would be to manually add a “G54” before each aperture change, and see how CircuitCAM or DirtyPCBs reacts to this. I might get round to that sometime (don’t hold your breath).
OR if you have examples of working gerbers and non-working gerbers can you check how the Dnn lines look?

thanks! Let’s fix this - it’s annoying!

OK, lets check 1 of 2, where I got access to the whole shebang.

I tested this project, made with KiCAD BRZ5060 as mentioned in the gerbers (you have to load handystick_panel.pro):

The board is available at DPCB here:

And the gerbers seem to work as can be seen here (*):

So, I loaded handystick_panel.pro and plotted the gerbers with my settings in BRZ6097 (sans the extended gerber attribute option) in a new directory for comparison (attached for your perusal [1]).

BRZ6097 has got a G04 in line 1 with some info… BRZ5060 doesn’t have this.
BRZ6097 does miss G74* before the G01* commands as mentioned in the OP.
Besides that files are identical.

BRZ5060 must have been created using ‘keep zeros’ instead of ‘decimal’.
BRZ6097 adds some info in line 2&3, ‘FMAT,2’ in line 4 and an extra command ‘M71’ in line 15… besides that the files are identical.

F.Cu, B.Cu, F.Mask, B.Mask, F.Silk, B.Silk
BRZ6097 have got a G04 in line 1 with some info… BRZ5060 files don’t have this.
Besides that files are identical.
Deviating from my settings in the OP the option ‘plot footprint references’ had been activated to get the same content as the BRZ5060 silkscreen gerbers.

As the drill file never has been a problem for DPCB we might ignore it for the purpose of this hunt.
It seems that the G04 command at the beginning of the gerbers (before %FSLAX46Y46*%) is throwing things off. For example:

G04 #@! TF.FileFunction,Soldermask,Bot*

Looking at it this way the missing G74* command might actually not have been the culprit…?
Will test this as soon as I have a new board to make (shouldn’t be too long :wink: )

Oh, nearly forgot… I did set ‘default line width’ to 0.1 for the board I mention in the OP where as in the BRZ5060 files this value seems to be 0.15. Don’t think it would have influence, but yeah… for comparison I had the plots from BRZ6097 done with default line width at 0.15 too.

*) assumption being here that the gerbers on github are the ones that DPCB has been using.

[1] handystick_BRZ5060-vs-BRZ6097.zip (135.9 KB)

On to sample 2 of 2:

KiCAD 2014-jul-16 BZR unknown has been used and the project can be found here:

Board at DPCB shop here:

Hm… looking with gerbview at the gerbers in the Rev.3 folder from the BZRunknown KiCAD version and comparing them with the gerbers that come out of the KiCAD kicad_pcb with BZR6097 it’s obvious there have modifications been made already, as there are differences in the layout.
A line-by-line comparison of the gerbers is not useful here…

Looking out for the G04* at line 1 for the BRZunknown gerber files though does yield that those commands are not there. The gerbers start all with ‘%FSLAX46Y46*%’ in line 1.
Looking at the edge.cuts file the G74* command preludes the G01* command as well.

My money now is on the G04 command in line 1 to be the problem at DirtyPCBs.

[edit: added later]
I have some more projects here with gerbers from earlier KiCAD versions and those have got G04 at line 1 too… for example (.GBO):

G04 (created by PCBNEW (2014-01-10 BZR 4027)-stable) date Thursday, November 27, 2014 ‘pmt’ 01:46:01 pm*
G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*

I just don’t know if those files had been successfully used on DPCBs…
And then there are gerbers from other projects which look completely different again (must be Eagle or Altium I guess, who knows) which start like this (.GBO):


G04 is a comment. In all my files, including some going back to rev 4xxx these appear in Line 2 and 3 rather than Line 1.

G74 is an arc drawing parameter (Set Single Quadrant) which places a restriction that arcs must be <=90 deg in extent. A related command is G75 (Set Multi Quadrant) in which an arc can even be a complete circle (some buggy older CAM software has trouble with full circles). At least one of G74 or G75 must appear before any ARC data appears in a file otherwise the file is invalid. G74/75 will apply to all following arcs until the mode is changed by another G74/G75 command.

It’s certainly not easy working out what’s going on when you don’t have the CAM in question installed on your computer. At least the Gerber specification is freely available so you can always check the file against the spec (if you have time to work out enough of the spec).

Had another machine I just fired up with some older KiCADs…
BZR5978 and BZR5796.
Both put a G04 in line 1 before ‘%FSLAX46Y46*%’ if I don’t use the ‘Include extended attributes’ for the gerber options… otherwise the G04 line is missing and I get like 4 lines starting with ‘%TF…’ before ‘%FSLAX46Y46*%’.
DPCB couldn’t use files like that either - experience from my 1st order with them…

Funnily enough, I contacted Iñigo of ElectroQuark about the issue (as he has a blog entry about using KiCAD with DPCB and his boards had been made) and he used/uses BZR5935.
Can tell you more once I had a look at his gerbers.

I hope it’s not something I do constantly wrong here on my end… :worried:

[edit: gerbers are here from BZR5935 - Thanks Iñigo]

G04 #@! TF.FileFunction,Soldermask,Bot*
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
G04 Created by KiCad (PCBNEW (2015-07-13 BZR 5935)-product) date 14/07/2015 14:58:16*

?!? :confused:

I think I can forget about being able to use DPCB successfully.


Comments cannot start with “ #@!”. This is reserved for future use as standardized comments.

from page 94 of Revision 2015.10 of https://www.ucamco.com/files/downloads/file/81/the_gerber_file_format_specification.pdf

Hm… only thing left I guess is putting up the files I have trouble with right?
Here they are.
If anyone got any CAM system and the will to run them through to enlighten me what’s wrong - be my host :wink:
ATmega-USB-Host_gerbers_kicadinfo.zip (165.2 KB)

Just to muddy the waters a bit more . . . here are the first dozen lines from a Gerber produced by KiCAD on 1 June of this year. I don’t know the BZR**** number, but it would have been a nightly build from sometime in May. The board was produced without problems, but NOT by DPCB:

 G04 #@! TF.FileFunction,Profile,NP*
 G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
 G04 Created by KiCad (PCBNEW (after 2015-may-01 BZR unknown)-product) date 01/06/2015 17:23:55*

And here are the initial lines from a Gerber file produced by a totally different (commercial) PWB program, sanitized to protect identities. This board was successfully fabricated by a low-cost Chinese company last January:

G04 File: FIELD_STR_METER_A.BRD, Tue Jan 06 05:55:34 2015*
G04 Source: ********** PCB, Version 17.01.22, (C:\Users\Dale\Documents******************\Field_Strength_Meter\Field_Str_Meter_A.pcb)*
G04 Format: Gerber Format (RS-274-D), ASCII*
G04 Format Options: Absolute Positioning*
G04 Leading-Zero Suppression*
G04 Scale Factor 1:1*
G04 NO Circular Interpolation*
G04 Inch Units*
G04 Numeric Format: 4.4 (XXXX.XXXX)*
G04 G54 NOT Used for Aperture Change*
G04 Apertures Embedded*
G04 File Options: Offset = (0.0mil,0.0mil)*
G04 Drill Symbol Size = 80.0mil*
G04 No Pad/Via Holes*
G04 File Contents: No Pads*
G04 No Vias*
G04 No Designators*
G04 No Types*
G04 No Values*
G04 No Drill Symbols*
G04 Board*
G04 Aperture MACROs for general use — invoked via D-code assignment *
G04 General MACRO for flashed round with rotation and/or offset hole *

It goes on for more than 200 additional lines (!) of what appear to be macro definitions, just to describe the outline of a rather simple board! The whole file is 410 lines - a comparable file produced by KiCAD (different rev of the same board) is only 66 lines. Putting all that info into comments at the start of the file seems like a reasonable idea, but I don’t know if it causes problems for some fabricators.


Yes, one dev has already noted that. The comments within headers are entirely optional at the moment (and therefore in his opinion, and mine as well, simply should never be done). I’ll ask the people who are more familiar with what’s going on there and let you know if you should file a bug report on that.

Any luck with the G74 stuff - have you checked that at least one G74 appears before any arcs are used? According to the spec only 1 ever needs to appear so if that condition is met then the problem is on the CAM side not behaving to spec; devs are reluctant to support other peoples’ buggy software but on the other hand we have to deal with the real world. We’d like people to nag their fabs to update software though or to nag their suppliers to fix bugs; more stringent specifications compliance is a Good Thing for everyone.

Yeah, I have no problem with Elecrow with those files… so far :wink:
Just wanted to test DPCB at some point in time.
As I said, next time I try again.

Hm… looking at the edge.cuts gerber I can see that there are G75 commands before G03 commands… so multi quadrant arc and then counter clockwise… what I don’t get if the KiCAD way of doing it like this:


is compatible with the specs that give examples for it like this (pages 73/74 in the 2015-10 gerber spec from above):


And with all that knowledge it naturally doesn’t really make sense to put a G74 before each G01 in the edge.cuts gerber, as this isn’t a valid specification for anything… (circular contour segment and then linear interpolation just doesn’t exist in the spec)

As for this… it’s pretty cool if you have meta data inside the file of question if you want to troubleshoot stuff post-mortem.
And if the CAM system “ignores” proper G04 comments content - not the ones with ‘G04 #@! blah blah’ like KiCAD seems to be prematurely use - then this is a good thing.

I work at university and sometimes have to go through raw data that has been collected months/years ago.
You know what is as important as the raw data?
Meta data about the data.
Anything really helps to make sense of the raw data.

If you have an idea of what sort of metadata would be useful we can make up a list and make a wishlist. Stuff from the Title Block would be a start I guess since that’s meant to identify the engineer/company who developed a particular PCB.

I heard that (old) chinese fab CAMs cannot deal with the extended gerber attributes.

I’ve talked to Ian, and I hope the kicad gerber issue will soon be fixed.


I managed to get my PCB’s to upload correctly to DirtyPCb’s.

When i uploaded to DirtyPCB, my board was shown as two black blobs. (no PCB to be seen).

I first read “Joan_Sparky” comments and I used most of it.
Altough I had none of these: “further down there where some G01* which now are behind a G74* like so”.

I went into the '‘Plot’ files that had been created and changed the ‘Edge Cuts’ extension from gm1 to gbr.

I do have images of my selections but as I am a new memeber on here I cannot upload them. When I can upload I will as its much easier to understand what I did.

This was then uploaded to DirtyPCB and the board was shown correctly !

Hope this helps.



Mine looked alright on the preview as well and had status ‘at boardhouse’…
My advice - get in contact with them if this status doesn’t change into ‘back from boardhouse’ for more than a week.

The very same files did yield at Elecrow without any fuss - now waiting on them to make their way from CN to OZ.

Hi Joan,

Please provide short feedback if the boards have arrived . DirtyPCB my favorite is Boardhouse . With Eagle , I have had no problems . This problem makes the change from Eagle to KiCad not easy :frowning:

Hi @Zh4ng, I had mine canceled and done by elecrow - still in transit.
You have to ask @questuk for current experience with DPCB and KiCAD as the source for the gerbers.
It will take another week for me till I have the next board routed to be sent of to a boardhouse…

Hi @Joan_Sparky ,
I did not know about elecrow. Interesting shop. Maybe I will give them a chance . I use KiCad and order my test board there . I’ll ask @questuk about the “GerberGate” and DirtyPCB. :smile:

Hi @Zh4ng,

I just finished creating my first PCB ever, of course in KiCad, and send it to dirtypcbs for manufacturing. I followed @Joan_Sparky instructions and my gerbers were accepted. Yesterday the status has changed to “shipped” so I guess the board house had no problems with manufacturing. I haven’t received them yet, though, so I don’t know if they were produced the way I wanted. I can report when they arrive, hopefully next week. I will experiment with unmodified gerbers at next order soon.

Hi all,

I have not got my PCB’s back from DirtyPCB, but they have been shipped so they must have processed OK :smile:

Hope this helps anyone.