Home > IPCB_PrimitivePad > setState_Hole
IPCB_PrimitivePad.setState_Hole() 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.
Set the property state: hole
Signature
typescript
function setState_Hole(hole: TPCB_PrimitivePadHole): IPCB_PrimitivePad;1
Parameters
Parameter | Type | Description |
|---|---|---|
hole | Pad drilling |
Returns
Pad primitive object
Remarks
When setting the hole, some other property states will be set in conjunction:
- The layer will be forcibly switched to multi-layer
This API cannot set the hole to null. If you want to remove the hole property, use the setState_Layer method to switch the layer to the top or bottom layer
Example
javascript
// 1. 生成本次运行专用的坐标,创建一个无孔的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', null, 0, 0, 0, false, 0);
const beforeHole = pad.getState_Hole();
// 2. 异步模式下设置 35mil 圆孔并提交
const a = pad.toAsync();
a.setState_Hole(['ROUND', 35]);
await a.done();
// 3. 从画布重新读取,确认孔已生效且层被联动切到多层(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('hole:', beforeHole, '→', ref.getState_Hole());
console.log('layer:', ref.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