Home > IPCB_PrimitiveVia > toAsync
IPCB_PrimitiveVia.toAsync() method
将图元转换为异步图元
签名
typescript
function toAsync(): IPCB_PrimitiveVia;1
返回值
过孔图元对象
示例
javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 切换为异步图元(返回同一图元的异步形态)
const asyncVia = via.toAsync();
// 3. 在异步模式下平移位置并提交
asyncVia.setState_X(x + 200);
await asyncVia.done();
// 4. 从画布重新读取,确认修改已落画布(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('isAsync:', asyncVia.isAsync());
console.log('x:', x, '→', ref.getState_X());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16