Home > PCB_Layer > setPcbType
PCB_Layer.setPcbType() 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.
Set PCB type
Signature
typescript
function setPcbType(pcbType: EPCB_PcbPlateType): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
pcbType | PCB type |
Returns
Promise<boolean>
Whether the operation is successful
Remarks
This is mainly to support FPC flexible board design. If the PCB type is set to FPC flexible board, an FPC stiffener layer will be added.
Please note:
EasyEDA does not yet support FPC flexible board production with more than 2 copper layers;
When switching the PCB type from FPC flexible board to ordinary board, any primitives on the FPC stiffener layer must be deleted in advance; otherwise, the switch will fail and
falsewill be returned.
Example
javascript
// 1. 记录切换前的图层总数
const before = await eda.pcb_Layer.getAllLayers();
// 2. 切换为 FPC 软板(FPC=2),自动新增补强层
const fpcResult = await eda.pcb_Layer.setPcbType(2);
// 3. 查看切换后的图层总数变化
const fpcLayers = await eda.pcb_Layer.getAllLayers();
// 4. 切回普通板材(NORMAL=1),恢复原板材类型
const restoreResult = await eda.pcb_Layer.setPcbType(1);
console.log('fpcResult:', fpcResult);
console.log('layerCountBefore:', before.length, '→ layerCountAfter:', fpcLayers.length);
console.log('restoreResult:', restoreResult);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15