Home > PCB_Layer > removeLayer
PCB_Layer.removeLayer() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
移除层
签名
typescript
function removeLayer(layer: TPCB_LayersOfCustom): Promise<boolean>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
layer | 层 |
返回值
Promise<boolean>
操作是否成功
备注
当前仅支持移除自定义层
示例
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