Home > PCB_PrimitivePad > create
PCB_PrimitivePad.create() method
Create Pad
Signature
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>;2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Parameters
Parameter | Type | Description |
|---|---|---|
layer | Layer | |
padNumber | string | Pad number |
x | number | X position |
y | number | Y position |
rotation | number | (Optional) Rotation angle |
pad | (Optional) Pad shape. This parameter is required before the special pad shape is implemented | |
net | string | (Optional) Net name |
hole | TPCB_PrimitivePadHole | null | (Optional) Hole. |
holeOffsetX | number | (Optional) Hole offset X |
holeOffsetY | number | (Optional) Hole offset Y |
holeRotation | number | (Optional) Rotation angle of the hole relative to the pad |
metallization | boolean | (Optional) Whether the hole wall is plated |
padType | (Optional) Pad type | |
specialPad | (Optional) Special pad shape. Currently not implemented; please do not use it | |
solderMaskAndPasteMaskExpansion | (Optional) Solder mask/paste mask expansion. | |
heatWelding | IPCB_PrimitivePadHeatWelding | null | (Optional) Thermal relief optimization parameters |
primitiveLock | boolean | (Optional) Whether it is locked |
Returns
Promise<IPCB_PrimitivePad | undefined>
Pad primitive object
Example
// 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());2
3
4
5
6
7
8
9
10
11
12
13
14
15