Home > IPCB_PrimitivePoured > deletePourFills
IPCB_PrimitivePoured.deletePourFills() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
删除覆铜填充区域
签名
typescript
function deletePourFills(
pourFillIds: IPCB_PrimitivePouredPourFill['id'] | Array<IPCB_PrimitivePouredPourFill['id']>,
): Promise<boolean>;1
2
3
2
3
参数名
参数 | 类型 | 描述 |
|---|---|---|
pourFillIds | IPCB_PrimitivePouredPourFill['id'] | Array<IPCB_PrimitivePouredPourFill['id']> | 覆铜填充区域 ID |
返回值
Promise<boolean>
删除操作是否成功
示例
javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 取填充子区域列表(本方法按 pourFillId 定位,不是图元 ID)
const pourFills = poured.getState_PourFills();
if (pourFills.length === 0) {
console.log('说明:该覆铜填充没有子区域');
return;
}
console.log('删除前子区域数量:', pourFills.length);
// 3. 删除第一个子区域(传单个 ID;也可以传 ID 数组批量删除)
const deleted = await poured.deletePourFills(pourFills[0].id);
// 4. 从画布重新读取,确认删除结果
const refreshed = await eda.pcb_PrimitivePoured.get(poured.getState_PrimitiveId());
const after = refreshed ? refreshed.getState_PourFills().length : 0;
console.log('deleted:', deleted);
console.log('删除后子区域数量:', after);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24