Home > PCB_PrimitivePour > create
PCB_PrimitivePour.create() 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.
Create Copper border
Signature
typescript
function create(
net: string,
layer: TPCB_LayersOfCopper,
complexPolygon: IPCB_Polygon,
pourFillMethod?: EPCB_PrimitivePourFillMethod,
preserveSilos?: boolean,
pourName?: string,
pourPriority?: number,
lineWidth?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitivePour | undefined>;1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Parameters
Parameter | Type | Description |
|---|---|---|
net | string | Net name |
layer | Layer | |
complexPolygon | Complex polygon object | |
pourFillMethod | (Optional) Copper fill method | |
preserveSilos | boolean | (Optional) Whether to keep islands |
pourName | string | (Optional) Copper name |
pourPriority | number | (Optional) Copper priority |
lineWidth | number | (Optional) Line width |
primitiveLock | boolean | (Optional) Whether it is locked |
Returns
Promise<IPCB_PrimitivePour | undefined>
Copper border primitive object
Example
javascript
// 1. 生成随机起点坐标,避免与画布上已有的覆铜边框重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 用 pcb_MathPolygon.createPolygon 构造覆铜轮廓:500×300 的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
// 3. 在顶层铜层创建覆铜边框:挂 GND 网络、实心填充、不保留孤岛、优先级 5、线宽 10mil、不锁定
// 注意:net 不能传空字符串(会报参数不正确),需传已有网络名
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_覆铜', 5, 10, false);
// 4. 创建类保留现场,不删除图元
console.log('primitiveId:', pour.getState_PrimitiveId());
console.log('primitiveType:', pour.getState_PrimitiveType());
console.log('pourName:', pour.getState_PourName());
console.log('pourFillMethod:', pour.getState_PourFillMethod());
console.log('pourPriority:', pour.getState_PourPriority());
console.log('layer:', pour.getState_Layer());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18