Home > PCB_PrimitivePour > modify
PCB_PrimitivePour.modify() 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.
Modify Copper border
Signature
typescript
function modify(
primitiveId: string | IPCB_PrimitivePour,
property: {
net?: undefined | string;
layer?:
| undefined
| EPCB_LayerId.TOP
| EPCB_LayerId.BOTTOM
| EPCB_LayerId.INNER_1
| EPCB_LayerId.INNER_2
| EPCB_LayerId.INNER_3
| EPCB_LayerId.INNER_4
| EPCB_LayerId.INNER_5
| EPCB_LayerId.INNER_6
| EPCB_LayerId.INNER_7
| EPCB_LayerId.INNER_8
| EPCB_LayerId.INNER_9
| EPCB_LayerId.INNER_10
| EPCB_LayerId.INNER_11
| EPCB_LayerId.INNER_12
| EPCB_LayerId.INNER_13
| EPCB_LayerId.INNER_14
| EPCB_LayerId.INNER_15
| EPCB_LayerId.INNER_16
| EPCB_LayerId.INNER_17
| EPCB_LayerId.INNER_18
| EPCB_LayerId.INNER_19
| EPCB_LayerId.INNER_20
| EPCB_LayerId.INNER_21
| EPCB_LayerId.INNER_22
| EPCB_LayerId.INNER_23
| EPCB_LayerId.INNER_24
| EPCB_LayerId.INNER_25
| EPCB_LayerId.INNER_26
| EPCB_LayerId.INNER_27
| EPCB_LayerId.INNER_28
| EPCB_LayerId.INNER_29
| EPCB_LayerId.INNER_30;
complexPolygon?: undefined | IPCB_Polygon;
pourFillMethod?:
| undefined
| EPCB_PrimitivePourFillMethod.GRID45
| EPCB_PrimitivePourFillMethod.GRID
| EPCB_PrimitivePourFillMethod.SOLID;
preserveSilos?: undefined | false | true;
pourName?: undefined | string;
pourPriority?: undefined | number;
lineWidth?: undefined | number;
primitiveLock?: undefined | false | true;
},
): Promise<IPCB_PrimitivePour | undefined>;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Parameters
Returns
Promise<IPCB_PrimitivePour | undefined>
Copper border primitive object, undefined indicates that the modification failed
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]);
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_覆铜', 5, 10, false);
const pourId = pour.getState_PrimitiveId();
// 2. 读取修改前的层与优先级
const beforeLayer = pour.getState_Layer();
const beforePriority = pour.getState_PourPriority();
// 3. 批量修改:层从顶层(1)换到底层(2),优先级 5 → 6
await eda.pcb_PrimitivePour.modify(pourId, { layer: 2, pourPriority: 6 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitivePour.get(pourId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', pourId);
console.log('layer:', beforeLayer, '→', refreshed.getState_Layer());
console.log('pourPriority:', beforePriority, '→', refreshed.getState_PourPriority());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21