Apologies from atommann (an engineer from JLCPCB), about Gerber X2 files at JLCPCB

It’s just the default. The other option would be to have X2 disabled by default and let people send files without newer features to all manufacturers. The history of X2 goes back to 2012 or 2014. Is it too much to expect that large commonly used manufacturers can interpret 7 years old file format?

Also remember that X2 had be unchecked with v5.1, too. It’s the new aperture macro change which lead to this large scale problem with 5.99.

You sound like a salesman for UCAMCO.

1 Like

Not just the default, it’s “recommended”. As wikipedia might say, by who?

Again, why do I have to join this modernisation crusade if what I have works?

Its good that @atommann from JLCPCB is looking into this but basically something isn’t right. There are two options in question and thus four combinations

  • Use X2 format
  • Disable Aperture macro

Configuration #1
[ ]Use X2 format
[ ] Disable macro

CAM-A worked
CAM-B failed

Configuration #2
[ ]Use X2 format
[X] Disable macro

CAM-A worked
CAM-B worked

That leaves two other configurations

Configuration #3
[X]Use X2 format
[ ] Disable macro

This is the combination that I use and in the year I have sent cards to: elecrow, ragwork, invotec, garner all returned as expected so at least there is some confidence in this configuration

Configuration #4
[X]Use X2 format
[X] Disable macro

Right now the macro appears to be the biggest culprit and @eelik implied this

You can do what you like and use who you like. I personally would not trust a fabrication house that has questionable RS-274D parser.

And I don’t appreciate your tone. who I am and what I do is inconsequential to this discussion so why even make such a statement

2 Likes

See my thread linked above, where I talk about two orders that I submitted to JLCPCB, with those configurations 3 and 4. Both caused issues.

Yes I did see, which means there are all four combinations covered
so there are other datapoints that show there is parsing concerns. Now since X2 is added to comments: https://www.ucamco.com/en/gerber/demo-1#Q3

This really does imply that the JLCPCB has an X1 parsing problem and since I have used X2 to a number of fabricators with no problems (some RS274D, some RS274X) at least aspects of KiCad’s generation is valid

If an application chokes on Gerber X2, it is not a compliant Gerber X1.

I am not saying you are a salesman, only that you sound like one.

But regardless, I apologize. You are right, no one should care who you are or what you do.

1 Like

Notes from jp who maintains the kicad gerber implementation and gets involved with UCAMCO who writes the spec.

2 Likes

Today I collected some information about the defective boards I see recently. I think these are not all of them.

Case 1
2020-12-05
Defect: Traces on top and bottom layers are missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.8)-1*%

Case 2
2020-12-09
Defect: Traces on top and bottom layers are missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.6)-1*%

Case 3
2020-12-07
Defect: Traces on top and bottom layers are missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.7)-1*%

Case 4
2020-12-29
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-7681-ge37a89cdbf)*%
%AMRoundRect*

Case 5
2021-01-03
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,5.99.0-unknown-e48f2a70fe~106~ubuntu20.04.1*%
%AMRoundRect*

Case 6
2020-12-31
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,5.99.0-unknown-81d4e06f00~106~ubuntu20.04.1*%
%AMRoundRect*

Case 7
2020-12-05
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,5.99.0-unknown-1a9878d6d~106~ubuntu18.04.1*%
%AMRoundRect*

Case 8
2020-12-24
Defect: Bottom silkscreen is missing
%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-6667-gfc6fc88219)*%

case 9
2020-12-24
Defect: Some pads' soldermask were lost
%TF.GenerationSoftware,KiCad,Pcbnew,(5.1.6)-1*%

case 10
2020-12-23
Defect: Some corners are missing for Rounded Rectangle Pads
%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-7551-ge9817932e0)*%

We can see all of them are Gerber X2 files.

Because the RoundRect macro is still new (maybe it was introduced two months ago?), so we can see not so many boards are affected.

1 Like

This is a useful thread. I do not want to see more personal attacks or rudeness :policeman:

8 Likes

@atommann, Here’s a set of gerbers plotted with different settings in the latest Kicad 5.99 (8244-g9424d66d22). KiCad 5.99 generates different kinds of special shapes with aperture macros by default. I have plotted them with and without x2 and aperture macros. This is the set of pad shapes:

Here are the gerber files: gerber.zip (37.1 KB)

Can you send back the same set processed by your default process?

Here’s the whole project for reference: Flashpads.zip (329.6 KB)

2 Likes

The reason why I didn’t mentioned Configuration #3 and #4 is related to how engineers process X2 files at JLCPCB.

Configuration #3
[X]Use X2 format
[ ] Disable macro

Configuration #4
[X]Use X2 format
[X] Disable macro

As I mentioned in JLCPCB - strange issue with rounded rectangle pads + kicad nightly, the CAM-A is the main tool, it can not import Gerber X2 files at all (Honestly I did not used CAM-A, but other people always told me this, I’ll try myself once I got a chance). Now the engineer finds that he cannot import files into CAM-A, what he’s going to do? The answer is he has a secondary CAM which is CAM-B. CAM-B can read X2 files but it can not do the job right every time.

Configuration #1
[ ]Use X2 format
[ ] Disable macro

CAM-A shows the RoundRect macro correctly in my test before, so #1 may work too for KiCad 5.99. Why I chose #2 is because lots of CAM and Gerber readers have problem with aperture macros as lots of people already mentioned in this and other threads.

1 Like

Thank you very much for the test files. I’ll post the processed files back when they are done.

These custom polygons remind me another issue related to aperture macros (basically some Eagle users are affected): https://www.eevblog.com/forum/manufacture/jlc-pcb-reorientation-of-octagonal-pads/

Kinda off-topic: The author of Horizon EDA sent me files to test the Aperture Macros, I made 5 physical copies myself, and I felt lucky that I got the defective boards (because that’s what I expected :slight_smile:

I found that Gerbv can convert Gerber X2 to RS-274X file easily: Just open the file, Ctrl+s to save the active layer, then the file will be converted.

The contents of RoundRect macro from KiCad 5.99:

G04 Aperture macros list*
%AMRoundRect*
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*
4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*
0 Add four circle primitives for the rounded corners*
1,1,$1+$1,$2,$3,0*
1,1,$1+$1,$4,$5,0*
1,1,$1+$1,$6,$7,0*
1,1,$1+$1,$8,$9,0*
0 Add four rect primitives between the rounded corners*
20,1,$1+$1,$2,$3,$4,$5,0*
20,1,$1+$1,$4,$5,$6,$7,0*
20,1,$1+$1,$6,$7,$8,$9,0*
20,1,$1+$1,$8,$9,$2,$3,0*%
G04 Aperture macros list end*

And this is the converted Aperture Macro by Gerbv:

%AMMACRO12*
4,1,4,0.013223,0.001044,0.001044,0.013223,-0.013223,-0.001044,-0.001044,-0.013223,0.013223,0.001044,0.000000*
1,1,0.017224,0.013223,0.001044*
1,1,0.017224,0.001044,0.013223*
1,1,0.017224,-0.013223,-0.001044*
1,1,0.017224,-0.001044,-0.013223*
20,1,0.017224,0.013223,0.001044,0.001044,0.013223,0.000000*
20,1,0.017224,0.001044,0.013223,-0.013223,-0.001044,0.000000*
20,1,0.017224,-0.013223,-0.001044,-0.001044,-0.013223,0.000000*
20,1,0.017224,-0.001044,-0.013223,0.013223,0.001044,0.000000*
%

What’s the difference? Looks like only the parameters are replaced with the real numbers.

I noticed circles (aperture macro primitive code 1) in RoundRect has 5 parameters (the 5th is rotation) but in MACRO12 it has 4 parameters. In Gerber Aperture Macros are hard for everyone, Lukas mentioned the extra rotation parameter for circles crashed CAM350 at Seeedstudio.

I’m also curious:

  1. Why traces are lost for some Gerber X2 files but most of them are OK?
  2. Why only two rounded corner are missing and other twos are kept for the rounded rectangle pads?

Regarding the 2nd question, I want to test CAM-B without the 5th parameter for circles.

EDIT on 2021-01-11

I tested how the 5th parameter will affect CAM-B, the result can be found here:

As a child I used ballpoint refill with the ball removed to paint my PCBs and then I etched them in iron trichloride.
That worked, but I don’t regret that I joined the modernization crusade and stared to use IBM-XT with 640k RAM and without HDD to design my PCBs. That needed frequently swapping 320kB diskettes in drive B: (in A: there were the main Racal-Redac diskette not needed to be swapped).
That worked, but I don’t regret that I joined the modernization crusade and started to use for PCB designs the PC with HDD. I used to plot my PCBs at the back sides of cards from a large wall calendar (in 2:1 scale), then to order the photocopy of it and go with that photographic plates to small (those time) PCB manufacturing factory.
That worked, but I don’t regret that I joined the modernization crusade and started to replace my own plotting with sending the gerber files directly to that PCB manufacturing factory as soon as they purchased a photoplotter.
And so on…

5 Likes

I am afraid there is a mix between aperture macros and the (new) X2 format.

Aperture macros are a old feature of RS274X format an are not related to X2 format.
Aperture macros are used to describe a “complex” pad shape from more basic shapes (primitives).
Pads need usually to be flashed, therefore need a shape that is not painted, but drawn all in once.
This is due to the fact pad shapes are also used in post processing in CAM tools (tests, solder mask creation …)
Aperture macros can be defined by a set of primitives (circle, rect …) having a defined size, or having a size defined by variables (notation: $1 $2 …)
When shapes are defined by variable, only one aperture macro is needed by a shape (for instance round rect shape)
When shapes are defined by absolute values, one aperture macro is needed by a pad with a given size.
So one can have a lot of one aperture macros. This is obviously not a good idea.

By the way, Gerbv (not the Kicad Gerbview) does not handle correctly aperture macro rotations, like unfortunately many other Gerber viewers although this parameter is described in Gerber doc since at least 10 years)
(This is the reason Pcbnew does not use (unfortunately) rotated complex aperture macros).

X2 format is an other thing (having nothing to do with apertures):
X2 format adds metadata to Gerber files:

  • Identification of files (type of layers: copper, layer, silk screen) that avoid the ridiculous used of non standard protel extensions.
  • Net info: needed for CAM tools to automatically test the board.
    It is also used in the Kicad Gerber viewer: one can highlight a net, or all pads of a component for instance. Just this feature is enough to use the X2 format.

Note also one can create Gerber drill files and Gerber pick and place files (known as X3 extension)
At least they are correctly defined in Gerber file format.

This is not the case of Excellon drill files (no actual format defined) and not the case of P&P files.

6 Likes

Which is fair enough, except all indications are this is an Aperture macro parsing problem and not an X2 parsing problem. As others have said, X2 doesn’t change pad information, it’s the complete fabrication information since now the layer order is encoded rather than relying on interpretation of the filenames

Now CAM-A not loading X2 (rather than raising warning on the additional commented content) is a CAM vendor concern since if you have an X2 parsing problem then you have a serious X1 parsing problem

The good news is the 1st step in resolving a problem is understanding there is a problem

3 Likes

Maybe KiCAD should have a CAM350 compatibility downgrade selector for the low cost fabs?

What you mentioned I guess is aperture macro primitive Center Line (code 21), Gerbv can handle it correctly since a specific version (I don’t know when).

In a CAM tool I know, there’s a configuration parameter controls how Center Line will be rotated:

  • No (default) - Rotate aperture macro primitive around it’s center point
  • Yes - rotate around the 0;0

If this parameters is set to “Yes”, which will comply with Gerber spec. If set to “No”, Center Line will rotate around its own geometry center which is wrong (and this is the default!).

I’ve had the X2 attribute issue with a number of fabs, including domestic (US) fabs like Advanced Circuits (although that was when I first tried the X2 option in early 2019. They may be able to work with these files now.)

After being notified of issues by the vendor I went back to the X1 format and have been using this since.

My workflow includes a quick check of the gerber files in Gerbv version 2.6A. I’ve found that if Gerbv opens it without error and it looks normal, none of the vendors I work with will have issues.

I plotted a copper layer of a board I have been working on recently, designed in the latest nightlies, that I know will successfully generate X1 gerbers. If I plot X2, I received the following errors in Gerbv:

image

I understand this version of Gerbv is probably 10 years old but it has always been a good representation of vendor capability.