Home > PCB_PrimitivePoured > get
PCB_PrimitivePoured.get() 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.
Get Copper fill
Signature
typescript
function get(primitiveIds: string): Promise<IPCB_PrimitivePoured | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
primitiveIds | string | Copper fill primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned |
Returns
Promise<IPCB_PrimitivePoured | undefined>
Copper fill primitive object, undefined indicates that the retrieval failed
Example
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