JLCPCB - strange issue with rounded rectangle pads + kicad nightly

Recently ordered some boards from JLCPCB - first time getting boards made using gerbers from kicad nightly rather than kicad stable. The plotted gerbers appear fine in gerbview, ucamco reference viewer, and on the preview on the jlc website.

However, I checked back at the JLC website once they had processed the data for production, and the assembly preview showed strange pad shape. I assumed it was probably a bug with the web preview and downloaded the production data file from the order page, and examined the processed gerber files - unfortunately the problem is there as well, and presumably that means that my actual boards will have this issue.

The issue is that some rounded corners on pads have become a sharp concave corner:

Looking at the gerbers from kicad, it seems that the rounded rectangle pads are using aperture macros now in nightly:

0 Rectangle with rounded corners*
0 $1 Rounding radius*
0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*
0 Add a 4 corners polygon primitive as box body*
0 Add four circle primitives for the rounded corners*
0 Add four rect primitives between the rounded corners*

Something at JLC is breaking that macro, unfortunately. It’s as if some of the corner circles just go missing.

To be sure this was related to a change in nightly, I checked the gerbers for the previous revision of my board, which was done with stable kicad and made properly by JLC, and they do not appear to use aperture macros for the rounded rectangle pads.

I also note that the gerbers from stable kicad don’t show any warnings or errors when loaded in the ucamco reference viewer. But, when I load in my new gerbers from nightly, I get a big pile of warnings and one error. I don’t think these are actually related to this issue though. The warnings are all “Standard attribute ‘%TO.C’ is invalid, continuing”. The error was on one of the copper layers: “Invalid coincident draw, continuing without cleanup”. Note that this JLC rounding issue occurs on all layers where rounded rectangle pads exist - copper, mask, paste.

Overall I’m fairly sure this is a bug in whatever software JLC are using, not a kicad issue. But it is something that folks should be aware of.

1 Like

What are your gerber export settings?

EDIT: and what’s your KiCad version, are you using the latest nightly?

Version from the generated gerber files that I submitted: G04 Created by KiCad (PCBNEW 5.99.0-unknown-81d4e06f00~106~ubuntu20.04.1) date 2020-12-30 22:36:42*


I presume if I check “disable aperture macros” it would output gerbers that more closely resemble what I was getting from stable builds. But, it says “non recommended” so I left it as-is.

If I have understood correctly this option switches back to the old behavior, you should get the same result as in 5.1.

Somebody should contact JLCPCB and ask about the situation. KiCad creates correct output according to the gerber standard AFAIK. JLC is pretty popular amongst KiCad users and I think KiCad users are a largish customer base for them, so it would benefit everyone if they could interpret the default (and correct) output correctly.

I already sent them a message, but will probably be a few days before I hear back due to the holidays.

For now it is probably a good idea to turn off the macros to avoid this. And fortunately this should not cause any functional problems - for my design, anyway.

Alright, well I also submitted another PCB order with them, this time checking the “disable aperture macros” box. Again, I have downloaded the production file (.rar) from the JLC website and had a look at it. It unfortunately has a different set of weirdness going on…

In the production file they supply, there is a whole load of stuff most of which seems irrelevant. But, in the ‘yg’ subdirectory there is a copy of all of the files that you submitted (gerber or not) with original filenames. I had previously assumed that these were unmodified copies of the files you uploaded, but that does not appear to be the case. Comparing the same area of one copper layer between the files that I uploaded (left) and the files in the rar archive under the ‘yg’ directory (right):

Clearly, something has happened here that is corrupting the shapes of things. It appears the files have been converted to gerber X1 and converted from mm to inch at this stage. The ucamco reference viewer produces this warning about low precision, which seems like it could perhaps be the culprit:
Screenshot from 2021-01-05 15-01-14
Another thing I noted was that at this stage some modifications that I expected had not yet been applied to the PCB:

  1. Solder mask expansion - solder mask apertures still matched the pads exactly
  2. Tooling holes (because I used the assembly service and opted to have JLC add tooling holes at their discretion rather than specifying exact position myself)

Moving on, the ‘ok’ subdirectory in the rar archive contains another set of gerber files, but using two-letter (no extension) filenames. These files have clearly undergone significant further processing. For a start, the tooling holes are now present, and the soldermask apertures around pads were expanded. Looking at the files in outline view reveals that the whole file has been converted to a “painted” form where all details are made from lines and rectangles and nothing else. On some areas, it appears that whatever algorithm was run managed to effectively recover the original nice round corners:

But, in other places, it has painted the nasty jaggies literally:

Anyway, my best guess is that the problem stems from whatever processing step is converting my gerbers into inches with not enough decimal places.


JLCPCB has got the email from David, thank you all for the feedback, and we are very sorry for the troubles. By the way, recently some other KiCad users who use the nightly version also met this issue.

Here I try to explain how this happened:
KiCad nightly build 5.99 use Aperture Macro RoundRect to represent the rounded rectangular pads, but some CAM softwares just can not handle them properly/correctly.

Engineers who processes Gerber files mainly use two set of CAM softwares, let’s call them CAM-A and CAM-B, CAM-A is the primary tool.

The work flow is like this: If the engineer who processed the Gerbers found he/she can not import the Gerbers into CAM-A, he/she will try to use CAM-B to import the Gerbers, now CAM-B read the file successfully, he/she will export the Gerbers from CAM-B. Then again import these files (from CAM-B) into CAM-A to do further processing (remember CAM-A is the main tool).

CAM-A: Which can not handle Gerber X2 and RoundRect Aperture Macros.
CAM-B: Because Gerber X2 and RS-274X are compatible at image level, so CAM-B can partly handle Gerber X2 but not 100% OK.

So, when CAM-B imports the Gerbers from KiCad nightly 5.99, some round corners are missing and some sharp concave corners are formed. I think this can explain the defective pads in the first post of this thread.

I call this a “new EDA vs old CAM problem”. But as @eelik said:

The RoundRect macro comply with the Gerber standard. It’s just lots of CAM software can not handle aperture macros good enough.

The developers at JLCPCB have wrote a converter to convert the RoundRect macro apertures into other Gerber elements. But they are still debugging so this converter is still not put into use yet.

So currently please don’t use Gerber X2 when you place the order. And please check “Disable aperture macros” option to disable it. When the converter is ready I wish this problem will be solved.

Best regards,
An engineer from JLCPCB


Regarding David’s another order:

This issue is mainly caused by the use Gerber X2. As mentioned in my previous post, because Gerber X2 is not supported at JLCPCB, when the engineer processed the Gerbers, he/she will try to import the X2 files into CAM-B. This conversion caused the lower resolution. If you export RS-274X instead of Gerber X2, I think this issue will be gone.

I also want to mention the files in the “yg” [^1] folder. It contains the original Gerbers from the customers and generally it should not be modified! But it has been modified for David’s order.

By the way, I’ve never used KiCad nightly 5.99 for production. Now I’m installing it in Ubuntu 18.04 and want to test the Gerbers.

[^1]: yg is the abbreviation of Chinese Pinyin Yuan Jian (Chinese characters: 原件), which means “Original document”.



Thank you for the detailed explanation @atommann.

So, when exporting gerber files we should unselect “use extended x2 format” and select “disable aperture macros”, right?

I had also been supplying drill files in gerber format, so I presume it would be easier for you if we continued to use .drl / excellon format for that too.

Hi David,

Because I’m still installing KiCad 5.99 so I’m not 100% sure. But yes, currently jut to be safe, please uncheck “Use extended X2 format” and check “Disable aperture macros”.

Excellon files are always suggested. Drill map file are suggested too. By the way, I’m still writing the tutorial on how to export Gerbers from KiCad for JLCPCB. Once it’s done, I’ll post a thread in this forum.


There’s another issue with Gerber X2 from KiCad at JLCPCB: Traces will be lost.

It is also related to the work flow I mentioned above. When CAM-A can not read the file, engineers will try the files with CAM-B, CAM-B can partly process it, but for some designs the traces will be lost and only pads are left!

CAM softwares are just black boxes, no one knows what is happening when it processes the Gerbers. For example, the attributes information may interference the interpretation of the image elements even Gerber X2 is compatible at the image level with RS-274X. If the engineer first use a filter to remove the Gerber X2 attributes, then maybe both CAM-A and CAM-B can handle it.

But the aperture macros is still hard for some Gerber readers. There’s a related post from Horizon EDA’s blog (I think it is a good example): Gerber Aperture Macros are hard for everyone

In short, JLCPCB is still not ready for Gerber X2.


I guess I’ve figured out why two corners are lost for the rounded rectangle pads.
In thread Apologies from atommann (an engineer from JLCPCB), about Gerber X2 files at JLCPCB, I suspected it was caused by the 5th parameter (rotation angle) of Apertrure Macro Circle (Code 1), and it is!

Here’s the test I did this afternoon:

  1. Create a project in Kicad 5.99 and add several chip capacitors which uses RoundRect macros.
  2. Generate Gerber X2 files with Aperture Macros enabled.
  3. Import Gerbers into CAM-B, two rounded corners are missing.
  4. Copy top copper layer, remove the 5th parameter for circle.
  5. Import the modified Gerbers into CAM-B again, all 4 rounded corners are displayed correctly.

Same layer, circle with 5th parameter vs without 5th parameter:

The Gerber Format Specification Revision 2020.09, page 52:

The Gerber Format Specification November 2013 Revision J1, page 85:

1 Like

interesting and nice investigation.
So looking at the GERBER spec 2020.09, the 5th parameter is listed as OPTIONAL (default no rotation)

so if the example is:


so… if you have time, if you were to take a KiCad X2+macro GERBER set and manually remove that additional rotation parameter (whatever the angle) does it work in both CAM packages?

rotation on a circle seems odd because it is symmetrical … but it’s the spec. If manually removing works then one solution would be an option to suppress rotation information. Ideal solution is interacting with the CAM vendor but well :slight_smile:

@Naib It’s rotation around the macro origin, not rotation around the centre of the circle (which obviously does nothing).

However, for compatibility reasons I think KiCAD should be modified to avoid outputting the rotation parameter at all. I have raised an issue for this:


oooooh… that makes more sense :frowning:

and yes some UI option to disable rotation it probably the best. Then Fab houses can list their recomended settings.

I don’t even think it needs to be a UI option. What’s the point of outputting that data if it just serves to make the file bigger and less compatible? As far as I know KiCad never outputs a nonzero rotation there.

The point would be specification compliant. The updated specification w.r.t. the aperture macro explicitly states the rotation. While it is optional, it is still there and at some future date some new rotation might be required to create more complex openings and thus completely removing the ability to include this could cause problems later.

Also the inclusion would help with a statement that the format aligns to a certain version of the specification

Well, don’t output it if the value is zero, then.

that’s viable, as long as it was captured in some document that this is the behaviour…
i’m just from an industry where an awful lot of time and money is spent to exhaustively show not only compliance to but also the exact response to requirements is. If a source material that something is meant to show compliance to stated the format, then this would need to be demonstrated

Did another test on the rotation angle for aperture macro circle primitive.

Also just several chip capacitors with rounded corner rectangle pads. Modify one rotation angle to 22.5 degrees to see how the pads will look like in different Gerber viewers. (8.6 KB)

0 Add four circle primitives for the rounded corners*

Reference Viewer by Ucamco:

gerbview in KiCad 5.99:

tracespace view:

Gerbv 2.6.1 in Ubuntu 18.04: