Home > PCB_ManufactureData > getGerberFile
PCB_ManufactureData.getGerberFile() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get the PCB fabrication file (Gerber)
Signature
function getGerberFile(
fileName?: string,
colorSilkscreen?: boolean,
unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.INCH,
digitalFormat?: { integerNumber: number; decimalNumber: number },
other?: {
metallicDrillingInformation: boolean;
nonMetallicDrillingInformation: boolean;
drillTable: boolean;
flyingProbeTestingFile: boolean;
},
layers?: Array<{ layerId: EPCB_LayerId; isMirror: boolean }>,
objects?: Array<
| 'Pad'
| 'Via'
| 'Track'
| 'Text'
| 'Image'
| 'Dimension'
| 'BoardOutline'
| 'BoardCutout'
| 'CopperFilled'
| 'SolidRegion'
| 'FPCStiffener'
| 'Line'
| 'PlaneZone'
| 'ComponentProperty'
| 'ComponentSilkscreen'
| 'TearDrop'
>,
): Promise<File | undefined>;2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Parameters
Parameter | Type | Description |
|---|---|---|
fileName | string | (Optional) File name |
colorSilkscreen | boolean | (Optional) Whether to generate a color silkscreen fabrication file (EasyEDA-specific file) |
unit | (Optional) Unit | |
digitalFormat | { integerNumber: number; decimalNumber: number } | (Optional) Digital format |
other | { metallicDrillingInformation: boolean; nonMetallicDrillingInformation: boolean; drillTable: boolean; flyingProbeTestingFile: boolean } | (Optional) Other |
layers | Array<{ layerId: EPCB_LayerId; isMirror: boolean }> | (Optional) Exported layers. By default, they are exported according to EasyEDA production requirements |
objects | Array<'Pad' | 'Via' | 'Track' | 'Text' | 'Image' | 'Dimension' | 'BoardOutline' | 'BoardCutout' | 'CopperFilled' | 'SolidRegion' | 'FPCStiffener' | 'Line' | 'PlaneZone' | 'ComponentProperty' | 'ComponentSilkscreen' | 'TearDrop'> | (Optional) Exported objects. By default, they are exported according to EasyEDA production requirements |
Returns
Promise<File | undefined>
PCB fabrication file data
Remarks
You can use SYS_FileSystem.saveFile() API export the file to the local file system
Example
// 导出默认的 Gerber 文件
const gerberFile = await eda.pcb_ManufactureData.getGerberFile('MyBoard_Gerber');
if (gerberFile) {
console.log('Gerber 文件已生成:', gerberFile);
}
// 导出并保存到本地
const gerberFile = await eda.pcb_ManufactureData.getGerberFile(
'MyBoard_Gerber',
false,
ESYS_Unit.MILLIMETER,
{ integerNumber: 2, decimalNumber: 6 }
);
if (gerberFile) {
await eda.sys_FileSystem.saveFile(gerberFile,'Gerber.zip');
}
// 自定义导出层和对象
const gerberFile = await eda.pcb_ManufactureData.getGerberFile(
'Custom_Gerber',
false,
ESYS_Unit.INCH,
{ integerNumber: 3, decimalNumber: 5 },
{ metallicDrillingInformation: true, nonMetallicDrillingInformation: true, drillTable: false, flyingProbeTestingFile: false },
[{ layerId: EPCB_LayerId.TOP, isMirror: false }, { layerId: EPCB_LayerId.BOTTOM, isMirror: false }, { layerId: EPCB_LayerId.BOARD_OUTLINE, isMirror: false }],
['Pad', 'Via', 'Track', 'BoardOutline']
);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27