Home > IPCB_PrimitivePoured > addSolderMaskFill
IPCB_PrimitivePoured.addSolderMaskFill() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
添加:阻焊区域
签名
typescript
function addSolderMaskFill(
pourFillId: IPCB_PrimitivePouredPourFill['id'],
): Promise<IPCB_PrimitiveFill | undefined>;1
2
3
2
3
参数名
参数 | 类型 | 描述 |
|---|---|---|
pourFillId |
返回值
Promise<IPCB_PrimitiveFill | undefined>
阻焊区域填充图元对象,无法转换或 ID 错误将返回 undefined
示例
javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 取第一个填充子区域的 ID(本方法按 pourFillId 定位,不是图元 ID)
const pourFills = poured.getState_PourFills();
if (pourFills.length === 0) {
console.log('说明:该覆铜填充没有子区域');
return;
}
// 3. 为该子区域添加阻焊区域(保留现场供观察)
const solderMaskFill = await poured.addSolderMaskFill(pourFills[0].id);
// 4. 输出生成的阻焊填充图元信息
if (solderMaskFill) {
console.log('primitiveType:', solderMaskFill.getState_PrimitiveType());
console.log('primitiveId:', solderMaskFill.getState_PrimitiveId());
} else {
console.log('说明:未能生成阻焊区域(返回 undefined)');
}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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25