Home > IPCB_PrimitiveVia > setState_ViaType
IPCB_PrimitiveVia.setState_ViaType() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
设置属性状态:过孔类型
签名
typescript
function setState_ViaType(viaType: EPCB_PrimitiveViaType): IPCB_PrimitiveVia;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
viaType | 过孔类型 |
返回值
过孔图元对象
示例
javascript
// 1. 生成本次运行专用的坐标,放置一个通孔类型的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_ViaType();
// 2. 异步模式下切换为缝合孔并提交
const a = via.toAsync();
a.setState_ViaType(2);
await a.done();
// 3. 从画布重新读取,确认类型已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('viaType:', before, '→', ref.getState_ViaType());1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14