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.
Get BOM file
Signature
function getBomFile(
fileName?: string,
fileType?: 'xlsx' | 'csv',
template?: string,
filterOptions?: Array<{ property: string; includeValue: string | false | true }>,
statistics?: Array<string>,
property?: Array<string>,
columns?: Array<IPCB_BomPropertiesTableColumns>,
): Promise<File | undefined>;2
3
4
5
6
7
8
9
Parameters
Parameter | Type | Description |
|---|---|---|
fileName | string | (Optional) File name |
fileType | 'xlsx' | 'csv' | (Optional) File type |
template | string | (Optional) Template name |
filterOptions | Array<{ property: string; includeValue: string | false | true }> | (Optional) Filter rules, which should only contain the rules to be enabled. |
statistics | Array<string> | (Optional) Statistics, containing the names of all statistic items to be enabled |
property | Array<string> | (Optional) Properties, containing the names of all properties to be enabled |
columns | (Optional) Column properties and sorting. If |
Returns
Promise<File | undefined>
BOM file data
Remarks
You can use SYS_FileSystem.saveFile() API export the file to the local file system
Example
// 使用默认配置导出 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']
);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