Home > ISCH_PrimitivePin > setState_PinShape
ISCH_PrimitivePin.setState_PinShape() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
设置属性状态:引脚形状
签名
typescript
public setState_PinShape(pinShape: ESCH_PrimitivePinShape): ISCH_PrimitivePin;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
pinShape | 引脚形状 |
返回值
引脚图元对象
示例
javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,形状 None
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_PinShape();
// 3. 切换异步模式,把形状改成 Clock(时钟标记)后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_PinShape('Clock');
await asyncPin.done();
// 4. 从画布重新取引脚,确认形状已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinShape:', before, '→', refetched.getState_PinShape());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23