Home > IPCB_PrimitiveVia > reset
IPCB_PrimitiveVia.reset() 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.
Reset the async primitive to the current canvas state
Signature
typescript
function reset(): Promise<IPCB_PrimitiveVia>;1
Returns
Promise<IPCB_PrimitiveVia>
Via primitive object
Example
javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试过孔重合
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 切换异步模式,累计一处未提交的外径修改(40 → 99)
const asyncVia = via.toAsync();
asyncVia.setState_Diameter(99);
// 3. 重置:丢弃未提交的修改,回到画布当前状态
await asyncVia.reset();
// 4. 从画布重新读取,外径仍是 40(保留现场供观察)
const refetched = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('diameter after reset:', refetched.getState_Diameter());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