Excellon
The Excellon file format specifies how a circuit board should be drilled. Here is the full specification.
Here is what an Excellon file looks like:
; This line is a comment and is ignored
; The next line starts the "header":
M48
; Units and number format:
INCH,LZ
; One tool is defined with diameter 0.04 inches,
; drill rate of 300 inches/minute and 55000 RPM.
T1C.04F300S55
; End of header, M95 or %, and beginning of body:
M95
; Use tool 1 defined in the header
T1
; Drill at points (123.45, 234.5) and (12.345, 234.5):
X12345Y23450
X012345Y234500
; End of program;
M30
Probably the largest source of confusion with Excellon files is the number format. This is in part due to ambiguity and inconsistency in the specification of the format itself. Here is how to interpret numbers in the coordinates:
- If the coordinates have a period, the value is taken as is.
- Determine the units. These are specified with INCH or METRIC in the header, or with M72 or M71 respectively. If the units are inches the base format is 00.0000. If the units are millimeters, it's 000.000.
- Determine if leading or trailing zeros are used. This is specified as INCH,LZ or INCH,TZ (Assuming inches are used). If leading zeros, it means all zeros to the left are already present. If trailing zeros, all zeros to the right are already present.
Example: Assume INCH,LZ and a coordinate pair X12345Y023456. For the X value, complete the number of digits adding zeros to the right: 123450. Then shift the period to obtain 12.3456. For the Y value, we already have 6 digits, so just shift the period (and discard the 0 that is meaningless) to obtain 2.3456.
If trailing zeros are used (INCH,TZ), complete the total digits by adding zeros to the left. Then shift the period. If using millimeters it's exactly the same, but after completing the 6 digits, the period is shifted 3 digits instead of 4.
Support of Excellon in FlatCAM
- FlatCAM only reads Excellon. It does not write Excellon.
- FlatCAM supports only the drilling subset of Excellon. Routing is not supported (!).
- All machine-related instructions are ignored. FlatCAM uses an Excellon file only to determine where to drill.
- Units default to INCHES.
- Zeros default to leading (L).
- Base format is 00.0000 and 000.000 for inches and millimeter respectively. This will match at least 95% of Excellon files generated by most software.
- (!) = At this time but might be implemented in the future.
Gerber
The Gerber format specifies polygons. Shapes that have an area. Most commonly copper regions in a specific layer of a PCB. It is also used for solder masks, solder paste and artwork. Here is the full specification.
Here is what a Gerber file looks like:
G04 This line is a comment an is ignored.*
G04 Coordinate format specification:*
%FSLAX25Y25*%
G04 Set units to inches:*
%MOIN%
G04 Define an aperture:*
%ADD10C,0.100*%
G04 Change polarity to DARK:*
%LPD*%
G04 Select the the previously defined aperture:*
D10*
G04 Set interpolation mode to linear:*
G01*
G04 Move to (0, 0) without drawing:*
X0Y0D02*
G04 Draw to (5, 5) using aperture 10:*
X500000Y500000D01*
G04 Enf of file:*
M02*
Support of Gerber in FlatCAM
- The Gerber format is almost fully implemented in FlatCAM except for certain minor features.
- Holes in standard apertures (C, R, O and P) are not supported (!).
- Drawing (interpolation) is always done with a circular aperture even if a non-circular aperture is chosen. An equivalent size is calculated from the dimensions of the aperture and used as the diameter of a circular aperture. This is unlikely to ever affect a gerber for a PCB. This limitation does not affect flashing.
- Step and Repeat (SR) is not supported (!).
- (!) = At this time but might be implemented in the future.