Home > IPCB_PrimitivePad > setState_X
IPCB_PrimitivePad.setState_X() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
设置属性状态:位置 X
签名
typescript
public setState_X(x: number): IPCB_PrimitivePad;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
x | number | 位置 X |
返回值
焊盘图元对象
示例
javascript
// 1. 生成本次运行专用的坐标,创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 异步模式下右移 200mil 并提交
const a = pad.toAsync();
a.setState_X(x + 200);
await a.done();
// 3. 从画布重新读取,确认位置已更新(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('x:', x, '→', ref.getState_X());1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13