Numerical Matrix Format
User Reference
GERBER array

MATRIX Array Level: 1

The GERBER array describes the relationship between the Layer and Gerber file (or NC Drill/Rout file) that will be imported. If you are importing Gerber and NC files, it's important to fully understand the GERBER array.

New! We've recently added the option detect_layer_types, which Detect all layer types and stackup order based on layer names. In many cases it's no longer necessary to define the GERBER array. Which drastically simplifies creating the matrix file format.

Note
Either the GERBER array or the option detect_layer_types is required when importing Gerber and NC files.

Important: Placing a semi-colon ; at the end of either LAYER or COMPOSITE fields will allow you to assign LAYER_TYPE and the Drill Span without having to create LAYER arrays.
Important: It is good practice to add the LAYER or COMPOSITE fields in the order of your PCB's stackup. Especially for Metal layers.
Important: All files paths in the GERBER array must be realtive (for use with PcbPreflight.com)

Fields in the GERBER array
Description
NAME=JOBNAME The name of the job to create. This will be directly referenced in other arrays such as PANEL and ADD.
LAYER=VALUE

This field contains the layer name and Gerber file location, separated by a comma.

LAYER=LAYER_NAME,FILE

LAYER_NAME is the layer name that will be referenced throughout the entire Matrix file. Important: If left empty the name of the imported FILE will be used for the layer name.
FILE is the path of the Gerber/Drill file to load (may be relative or absolute)

Example 1:

# This will create a layer named "layer_4" and import file, C:\Board1\Bottom.gbr
LAYER=layer_4,C:\Board1\Bottom.gbr

XML example:

<!-- This will create a layer named "layer_4" and import file, C:\Board1\Bottom.gbr -->
<LAYER>layer_4,C:\Board1\Bottom.gbr</LAYER>

JSON example:

{
"LAYER": "layer_4,C:\\Board1\\Bottom.gbr"
}


Example 2: Empty Layer name. If left empty, the FILE name will be used for the layer name.

# This will create a layer named "Bottom_gbr" and import file, C:\Board1\Bottom.gbr
LAYER=,C:\Board1\Bottom.gbr

XML example:

<!-- This will create a layer named "Bottom_gbr" and import file, C:\Board1\Bottom.gbr -->
<LAYER>,C:\Board1\Bottom.gbr</LAYER>

JSON example:

{
"LAYER": ",C:\\Board1\\Bottom.gbr"
}

COMPOSITE=VALUE

Merge multiple files into a single layer. COMPOSITE is similar to the existing LAYER feature, however COMPOSITE allows you to merge multiple files into a single layer. You can assign whether the merging file will be Dark or Clear, and even add a Size value (should you wish to enlarge or reduce object sizes).

COMPOSITE=LAYER_NAME,LAYER_POLARITY,FILE,CONTRAST,SIZE,FILE(n),CONTRAST(n),SIZE(n),(...)

LAYER_NAME is the layer name that will be referenced throughout the entire Matrix file. Cannot be empty.
LAYER_POLARITY choose either POSITIVE or NEGATIVE
FILE is the path of the Gerber/Drill file to load (may be relative or absolute)
CONTRAST choose either DARK or CLEAR
SIZE is any value to enlarge or reduce. (0 is the default)

Repeat "file(n),contrast(n),size(n)" for as many files need to be merged. Composites are merged in the order of first file, second, etc. This field contains the layer name and Gerber file location, separated by a comma. Use either either relative or absolute paths.

Note: For DRILL and ROUT layer types, the file location must point to a NC file (not Gerber). The NC file must contain tool number, sizes in the header. If not, we recommend that you define a NCTOOLS array in the Matrix before the GERBER array.

Example:

COMPOSITE=L1,POSITIVE,MTOP.gbr,Dark,0,Antipad_MTOP.gbr,clear,0

LAYER TYPE,
START_DRILL,
END_DRILL

Using Semi-Colon
;

(Optional) Placing a semi-colon ; at the end of either LAYER or COMPOSITE fields will allow you to assign LAYER_TYPE and the Drill Span without having to create LAYER arrays. It's a very useful feature for quickly creating MATRIX files. It is good practice to build in the order of your PCB's stackup. Especially for Metal layers.

LAYER=VALUE;LAYERTYPE,START_DRILL,END_DRILL

LAYERTYPE is the layer type that will be assigned. Choose from the following Layer Types. (Default layer type is GRAPHIC)
START_DRILL is used to specify the starting span of the drill, and is only used when layer type is DRILL_BLINDBURIED. (Default is TOP layer)
END_DRILL is used to specify the end span of the drill, and is only used when layer type is DRILL_BLINDBURIED. (Default is BOTTOM layer)

Example:

COMPOSITE=L1,POSITIVE,MTOP.gbr,Dark,0,Antipad_MTOP.gbr,clear,0;TOP
LAYER=sst,Board1\Top Silk.gbr;SILK_TOP

LAYER SUBTYPE

Using a SECOND Semi-Colon
;

(Optional) Placing a SECOND semi-colon ; after a LAYER_TYPE to define a LAYER_SUBTYPE Layer Subtypes. It's a very useful feature for quickly creating MATRIX files. It is good practice to build in the order of your PCB's stackup. Especially for Metal layers.

LAYER=VALUE;LAYERTYPE,START_DRILL,END_DRILL;SUBTYPE

SUBTYPE is the layer subtype that will be assigned. Choose from the following Layer SUBTYPES.

Example:

COMPOSITE=L1,POSITIVE,MTOP.gbr,Dark,0,Antipad_MTOP.gbr,clear,0;TOP
LAYER=sst,Board1\Top Silk.gbr;SILK_TOP

BOUNDING_BOX=L,B,R,T (Optional) Assign the approximate job extents (in millimeters). Useful when importing drill files or old legacy gerber files (274D) that have limited format information.

Example GERBER array:

GERBER {
NAME=board1
LAYER=smb,C:\temp\examples\Board1\Bottom Mask.gbr
LAYER=layer_4,examples\Board1\Bottom.gbr
LAYER=smt,..\examples\Board1\Top Mask.gbr
LAYER=layer_1,..\examples\Board1\Top.gbr
LAYER=sst,C:\temp\examples\Board1\Top Silk.gbr
LAYER=d_1_2,C:\temp\examples\Board1\drill.drl
}

XML example:

<GERBER>
<NAME>board1</NAME>
<LAYER>smb,C:\temp\examples\Board1\Bottom Mask.gbr</LAYER>
<LAYER>layer_4,examples\Board1\Bottom.gbr</LAYER>
<LAYER>smt,..\examples\Board1\Top Mask.gbr</LAYER>
<LAYER>layer_1,..\examples\Board1\Top.gbr</LAYER>
<LAYER>sst,C:\temp\examples\Board1\Top Silk.gbr</LAYER>
<LAYER>d_1_2,C:\temp\examples\Board1\drill.drl</LAYER>
</GERBER>


JSON example:

"GERBER": {
"NAME": "board1",
"LAYER": [
"smb,C:\\temp\\examples\\Board1\\Bottom Mask.gbr",
"layer_4,examples\\Board1\\Bottom.gbr",
"smt,..\\examples\\Board1\\Top Mask.gbr",
"layer_1,..\\examples\\Board1\\Top.gbr",
"sst,C:\\temp\\examples\\Board1\\Top Silk.gbr",
"d_1_2,C:\\temp\\examples\\Board1\\drill.drl"
]
}


Example GERBER array using both Layer and Composite (to merge):

GERBER {
NAME=xmicro_6layer
LAYER=PM_TOP,PM_TOP.gbr
LAYER=Silk_TOP,text.gbr
LAYER=SM_TOP,SM_TOP.gbr
COMPOSITE=L1,POSITIVE,MTOP.gbr,Dark,0,Antipad_MTOP.gbr,clear,0
COMPOSITE=L2,POSITIVE,M2.gbr,Dark,0,Antipad_M2.gbr,clear,0
COMPOSITE=L3,POSITIVE,M3.gbr,Dark,0,Antipad_M3.gbr,clear,0
COMPOSITE=L4,POSITIVE,M4.gbr,Dark,0,Antipad_M4.gbr,clear,0
COMPOSITE=L5,POSITIVE,M5.gbr,Dark,0,Antipad_M5.gbr,clear,0
COMPOSITE=L6,POSITIVE,MBOT.gbr,Dark,0,Antipad_MBOT.gbr,clear,0,Pad_MBOT.gbr,Dark,0
LAYER=SM_BOT,SM_BOT.gbr
LAYER=Outline,Outline.gbr
LAYER=packages,packages.gbr
LAYER=xm_grid,xm_grid.gbr
LAYER=Backdrill,Backdrill.drl
LAYER=Hole_NP,Hole_NP.drl
LAYER=Hole_Plated,Hole_Plated.drl
LAYER=Via_MTOP-MBOT,Via_MTOP-MBOT.drl
}

Example GERBER array using semi-colon; All Layer types area defined here – no need for the LAYER array

# Important: When using semi-colon it's extrememly important that you define the metal layers in correct stackup order (for multi-layer PCB designs only).
GERBER {
NAME=testgerber
LAYER=layer_1,274X\Art0121.pho;TOP
LAYER=layer_2,274X\Pgp2529.pho;POS_PLANE
LAYER=layer_3,274X\gnd2530.pho;POS_PLANE
LAYER=layer_4,274X\Art02.pho;BOTTOM
LAYER=sst,274X\Sst0126.pho;SILK_TOP
LAYER=spt,274X\Sp0128.pho;PASTE_TOP
LAYER=smb,274X\Sm0227.pho;MASK_BOTTOM
LAYER=smt,274X\Sm0128.pho;MASK_TOP
LAYER=dimensions,274X\Dimensions.pho;
LAYER=d_1_2,274X\DrillBlind.drl;DRILL_BLINDBURIED,layer_1,layer_2
LAYER=drill_thru,274X\Drill.drl;DRILL_THRUHOLE
}

Example GERBER array using semi-colon; and no LAYER_NAME is assigned

# Important: When there is no LAYER_NAME assigned, the name of the imported FILE will be used for the layer name. This saves time when automating the creation of a matrix file.
GERBER {
NAME=testgerber
LAYER=,274X\Art0121.pho;TOP
LAYER=,274X\Pgp2529.pho;POS_PLANE
LAYER=,274X\gnd2530.pho;POS_PLANE
LAYER=,274X\Art02.pho;BOTTOM
LAYER=,274X\Sst0126.pho;SILK_TOP
LAYER=,274X\Sp0128.pho;PASTE_TOP
LAYER=,274X\Sm0227.pho;MASK_BOTTOM
LAYER=,274X\Sm0128.pho;MASK_TOP
LAYER=,274X\Dimensions.pho;
LAYER=,274X\DrillBlind.drl;DRILL_BLINDBURIED,layer_1,layer_2
LAYER=,274X\Drill.drl;DRILL_THRUHOLE
}


Example GERBER array using two semi-colons; and no LAYER_NAME is assigned

# Important: When there is no LAYER_NAME assigned, the name of the imported FILE will be used for the layer name. This saves time when automating the creation of a matrix file.
GERBER {
NAME=testgerber
LAYER=layer_1,274X\Art0121.pho;TOP
LAYER=layer_2,274X\Pgp2529.pho;POS_PLANE
LAYER=layer_3,274X\gnd2530.pho;POS_PLANE
LAYER=layer_4,274X\Art02.pho;BOTTOM
LAYER=sst,274X\Sst0126.pho;SILK_TOP
LAYER=spt,274X\Sp0128.pho;PASTE_TOP
LAYER=smb,274X\Sm0227.pho;MASK_BOTTOM
LAYER=smt,274X\Sm0128.pho;MASK_TOP
LAYER=dimensions,274X\Dimensions.pho;
LAYER=d_1_2,274X\DrillBlind.drl;DRILL_BLINDBURIED,layer_1,layer_2<b>;DRILL_BACKDRILL
LAYER=drill_thru,274X\Drill.drl;DRILL_THRUHOLE<b>;DRILL_DUALDIAMETER
}