Home > IPCB_PrimitivePour > rebuildCopperRegion
IPCB_PrimitivePour.rebuildCopperRegion() 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.
Rebuild the copper fill of the copper region
Signature
typescript
function rebuildCopperRegion(): Promise<IPCB_PrimitivePoured | undefined>;1
Returns
Promise<IPCB_PrimitivePoured | undefined>
The copper fill primitive. If no copper fill primitive is rebuilt, undefined is returned
Example
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