Home > PCB_ManufactureData > get3DFile
PCB_ManufactureData.get3DFile() 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.
获取 3D 模型文件
Signature
typescript
get3DFile(fileName?: string, fileType?: 'step' | 'obj', element?: Array<'Component Model' | 'Via' | 'Silkscreen' | 'Wire In Signal Layer'>, modelMode?: 'Outfit' | 'Parts', autoGenerateModels?: boolean): Promise<File | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
fileName | string | (Optional) 文件名 |
fileType | 'step' | 'obj' | (Optional) 文件类型 |
element | Array<'Component Model' | 'Via' | 'Silkscreen' | 'Wire In Signal Layer'> | (Optional) 导出对象 |
modelMode | 'Outfit' | 'Parts' | (Optional) 导出模式, |
autoGenerateModels | boolean | (Optional) 是否为未绑定 3D 模型的元件自动生成 3D 模型(根据元件的"高度"属性) |
Returns
Promise<File | undefined>
3D 模型文件数据
Remarks
请注意:只有以 STEP 格式导入的元件模型,才能在导出的 STEP 文件中体现
可以使用 SYS_FileSystem.saveFile() 接口将文件导出到本地文件系统
Example
javascript
// 导出装配体模式的 STEP 文件(包含元件模型)
const stepFile = await eda.pcb_ManufactureData.get3DFile(
'MyBoard_3D',
'step',
['Component Model'],
'Outfit',
true
);
if (stepFile) {
await eda.sys_FileSystem.saveFile(stepFile);
}
// 导出包含多种对象的完整 3D 模型
const full3DFile = await eda.pcb_ManufactureData.get3DFile(
'Complete_3D_Model',
'step',
['Component Model', 'Via', 'Silkscreen', 'Wire In Signal Layer'],
'Outfit',
true
);
// 导出零件模式 OBJ 文件
const objFile = await eda.pcb_ManufactureData.get3DFile(
'MyBoard_OBJ',
'obj',
['Component Model'],
'Parts',
false
);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
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