Home > PCB_PrimitivePoured > get
PCB_PrimitivePoured.get() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取覆铜填充
签名
typescript
function get(primitiveIds: string): Promise<IPCB_PrimitivePoured | undefined>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
primitiveIds | string | 覆铜填充的图元 ID,可以为字符串或字符串数组,如若为数组,则返回的也是数组 |
返回值
Promise<IPCB_PrimitivePoured | undefined>
覆铜填充图元对象,undefined 表示获取失败
示例
javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const ids = pouredList.slice(0, 2).map(p => p.getState_PrimitiveId());
// 2. 传单个 ID 字符串,返回单个覆铜填充对象
const single = await eda.pcb_PrimitivePoured.get(ids[0]);
// 3. 传 ID 数组,返回覆铜填充对象数组(未匹配到的 ID 不影响其它项返回)
const arr = await eda.pcb_PrimitivePoured.get(ids);
const partial = await eda.pcb_PrimitivePoured.get([ids[0], 'unknown-id']);
console.log('single primitiveType:', single.getState_PrimitiveType());
console.log('array length:', arr.length);
console.log('含未匹配 ID 时返回数量:', partial.length);
console.log('关联覆铜边框 ID:', single.getState_PourPrimitiveId());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19