Home > PCB_ManufactureData > getBomFile
PCB_ManufactureData.getBomFile() 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.
获取 BOM 文件
Signature
typescript
getBomFile(fileName?: string, fileType?: 'xlsx' | 'csv', template?: string, filterOptions?: Array<{
property: string;
includeValue: boolean | string;
}>, statistics?: Array<string>, property?: Array<string>, columns?: Array<IPCB_BomPropertiesTableColumns>): Promise<File | undefined>;1
2
3
4
2
3
4
Parameters
Parameter | Type | Description |
|---|---|---|
fileName | string | (Optional) 文件名 |
fileType | 'xlsx' | 'csv' | (Optional) 文件类型 |
template | string | (Optional) 模板名称 |
filterOptions | Array<{ property: string; includeValue: boolean | string; }> | (Optional) 过滤规则,仅应包含需要启用的规则, |
statistics | Array<string> | (Optional) 统计,包含所有需要启用的统计项的名称 |
property | Array<string> | (Optional) 属性,包含所有需要启用的属性的名称 |
columns | (Optional) 列的属性及排序, |
Returns
Promise<File | undefined>
BOM 文件数据
Remarks
可以使用 SYS_FileSystem.saveFile() 接口将文件导出到本地文件系统
Example
javascript
// 使用默认配置导出 BOM
const bomFile = await eda.pcb_ManufactureData.getBomFile('MyBOM', 'xlsx');
if (bomFile) {
await eda.sys_FileSystem.saveFile(bomFile);
}
// 自定义 BOM 过滤和列配置
const bomFile = await eda.pcb_ManufactureData.getBomFile(
'Custom_Production_BOM',
'xlsx',
undefined,
[
{ property: 'Add into BOM', includeValue: 'yes' },
{ property: 'Convert to PCB', includeValue: 'yes' }
],
['No.', 'Quantity', 'Comment'],
['Name', 'Device', 'Designator', 'Supplier'],
[
{ property: 'Designator', title: '位号', sort: 'asc', group: 'No', orderWeight: 10 },
{ property: 'Quantity', title: '数量', sort: 'desc', group: 'Yes', orderWeight: 9 }
]
);
// 导出 CSV 格式 BOM
const csvBomFile = await eda.pcb_ManufactureData.getBomFile(
'Simple_BOM',
'csv',
undefined,
[{ property: 'Add into BOM', includeValue: 'yes' }],
['No.', 'Quantity'],
['Designator', 'Footprint', 'Value']
);1
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
32
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
32