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:
- Why traces are lost for some Gerber X2 files but most of them are OK?
- 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: