Home > PCB_PrimitivePour > create
PCB_PrimitivePour.create() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
创建覆铜边框
签名
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
参数名
参数 | 类型 | 描述 |
|---|---|---|
net | string | 网络名称 |
layer | 层 | |
complexPolygon | 复杂多边形对象 | |
pourFillMethod | (可选) 覆铜填充方法 | |
preserveSilos | boolean | (可选) 是否保留孤岛 |
pourName | string | (可选) 覆铜名称 |
pourPriority | number | (可选) 覆铜优先级 |
lineWidth | number | (可选) 线宽 |
primitiveLock | boolean | (可选) 是否锁定 |
返回值
Promise<IPCB_PrimitivePour | undefined>
覆铜边框图元对象
示例
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