Home > IPCB_PrimitiveVia > setState_PrimitiveLock
IPCB_PrimitiveVia.setState_PrimitiveLock() 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: whether it is locked
Signature
typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveVia;1
Parameters
Parameter | Type | Description |
|---|---|---|
primitiveLock | boolean | Whether it is locked |
Returns
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);
const before = via.getState_PrimitiveLock();
// 2. 异步模式下锁定并提交
const a = via.toAsync();
a.setState_PrimitiveLock(true);
await a.done();
// 3. 从画布重新读取,确认锁定已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', ref.getState_PrimitiveLock());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