Home > PCB_PrimitivePoured > getAllPrimitiveId
PCB_PrimitivePoured.getAllPrimitiveId() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取所有覆铜填充的图元 ID
签名
typescript
function getAllPrimitiveId(): Promise<Array<string>>;1
返回值
Promise<Array<string>>
覆铜填充的图元 ID 数组
示例
javascript
// 1. 获取画布上全部覆铜填充的图元 ID
const ids = await eda.pcb_PrimitivePoured.getAllPrimitiveId();
if (!ids || ids.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
// 2. 任取一个 ID 反查覆铜填充对象,验证列表有效
const poured = await eda.pcb_PrimitivePoured.get(ids[0]);
console.log('total poured ids:', ids.length);
console.log('refetched primitiveType:', poured.getState_PrimitiveType());1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12