Home > IPCB_PrimitivePour > rebuildCopperRegion
IPCB_PrimitivePour.rebuildCopperRegion() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
重建铺铜区域覆铜填充
签名
typescript
function rebuildCopperRegion(): Promise<IPCB_PrimitivePoured | undefined>;1
返回值
Promise<IPCB_PrimitivePoured | undefined>
覆铜填充图元,如若未重建出覆铜填充图元则返回 undefined
示例
javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个挂 GND 网络的覆铜边框(保留现场供观察)
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_重建覆铜', 5, 10, false);
// 3. 重建覆铜填充(成功时返回生成的覆铜填充图元)
let rebuilt = false;
let result;
try {
result = await pour.rebuildCopperRegion();
rebuilt = result !== undefined;
}
catch (e) {
// 当前版本在纯 API 创建的覆铜上重建会报内部错误,捕获后继续
console.log('说明:当前环境 rebuildCopperRegion 报错:', e.message);
}
console.log('rebuildRequested:', true);
console.log('hasCopperRegion:', rebuilt);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22