Home > PCB_PrimitivePad > create
PCB_PrimitivePad.create() method
创建焊盘
签名
typescript
function create(
layer: TPCB_LayersOfPad,
padNumber: string,
x: number,
y: number,
rotation?: number,
pad?: TPCB_PrimitivePadShape,
net?: string,
hole?: TPCB_PrimitivePadHole | null,
holeOffsetX?: number,
holeOffsetY?: number,
holeRotation?: number,
metallization?: boolean,
padType?: EPCB_PrimitivePadType,
specialPad?: TPCB_PrimitiveSpecialPadShape,
solderMaskAndPasteMaskExpansion?: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null,
heatWelding?: IPCB_PrimitivePadHeatWelding | null,
primitiveLock?: boolean,
): Promise<IPCB_PrimitivePad | undefined>;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
参数名
参数 | 类型 | 描述 |
|---|---|---|
layer | 层 | |
padNumber | string | 焊盘编号 |
x | number | 位置 X |
y | number | 位置 Y |
rotation | number | (可选) 旋转角度 |
pad | (可选) 焊盘外形,在特殊焊盘外形实现前,该参数必传 | |
net | string | (可选) 网络名称 |
hole | TPCB_PrimitivePadHole | null | (可选) 孔, |
holeOffsetX | number | (可选) 孔偏移 X |
holeOffsetY | number | (可选) 孔偏移 Y |
holeRotation | number | (可选) 孔相对于焊盘的旋转角度 |
metallization | boolean | (可选) 是否金属化孔壁 |
padType | (可选) 焊盘类型 | |
specialPad | (可选) 特殊焊盘外形,当前暂未实现,请勿使用 | |
solderMaskAndPasteMaskExpansion | (可选) 阻焊/助焊扩展, | |
heatWelding | IPCB_PrimitivePadHeatWelding | null | (可选) 热焊优化参数 |
primitiveLock | boolean | (可选) 是否锁定 |
返回值
Promise<IPCB_PrimitivePad | undefined>
焊盘图元对象
示例
javascript
// 1. 生成随机坐标,避免与画布上已有的焊盘重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层(1)创建一个 60x60 圆形贴片焊盘:外形用 ['ELLIPSE', 宽, 高],无孔传 null
const smd = await eda.pcb_PrimitivePad.create(1, '1', x, y, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 3. 在多层(12)创建一个 80x80 通孔焊盘:圆孔直径 35mil,金属化孔壁(沉铜)
const thru = await eda.pcb_PrimitivePad.create(12, '2', x, y + 500, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 35], 0, 0, 0, true, 0);
// 4. 创建类保留现场,不删除图元
console.log('smd padId:', smd.getState_PrimitiveId());
console.log('smd layer:', smd.getState_Layer());
console.log('thru padId:', thru.getState_PrimitiveId());
console.log('thru layer:', thru.getState_Layer());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15