Home > PCB_Layer > removeLayer
PCB_Layer.removeLayer() 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.
Remove Layer
Signature
typescript
function removeLayer(layer: TPCB_LayersOfCustom): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
layer | Layer |
Returns
Promise<boolean>
Whether the operation is successful
Remarks
Currently only custom layers can be removed
Example
javascript
// 1. 新增一个自定义层作为移除对象
const customLayerId = await eda.pcb_Layer.addCustomLayer();
// 2. 移除该自定义层,返回操作是否成功
const removeResult = await eda.pcb_Layer.removeLayer(customLayerId);
// 3. 确认该层已从图层列表消失
const rest = (await eda.pcb_Layer.getAllLayers()).filter(l => l.type === 'CUSTOM');
console.log('removeResult:', removeResult);
console.log('removedLayerId:', customLayerId);
console.log('customLayerLeft:', rest.length);1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12