English
Home > PCB_PrimitivePour > rebuildAllCopperRegions
PCB_PrimitivePour.rebuildAllCopperRegions() 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.
重建所有覆铜区域
Signature
typescript
function rebuildAllCopperRegions(): Promise<Array<IPCB_PrimitivePoured>>;1
Returns
Promise<Array<IPCB_PrimitivePoured>>
覆铜填充图元数组(按覆铜边框分组),无重建结果的覆铜边框不会出现在返回值中;画布上没有覆铜区域时返回空数组
Remarks
对当前 PCB 画布上的全部覆铜区域执行重建,无需传入任何参数
与 rebuildCopperRegions 的区别在于覆盖范围:本接口除覆铜边框图元生成的覆铜外,还包含内电层的覆铜
当前文档未激活或没有编辑权限时,本接口会抛出错误而非静默返回空数组
覆铜区域较多时本接口耗时较长,建议单独调用或在 beginCommandGroup 内成组执行 ADD since EDA v4.1.103
Example
javascript
// 1. 创建一条测试覆铜边框(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_重建全部', 5, 10, false);
// 2. 重建画布上全部覆铜区域(含内电层覆铜)
const pouredList = await eda.pcb_PrimitivePour.rebuildAllCopperRegions();
console.log('重建数量:', pouredList.length);1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9