English
Home > ISCH_PrimitiveRectangle > setState_BindSchematicPageUuid
ISCH_PrimitiveRectangle.setState_BindSchematicPageUuid() 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.
设置属性状态:绑定的原理图图页 UUID
Signature
typescript
function setState_BindSchematicPageUuid(
bindSchematicPageUuid: string | null,
): ISCH_PrimitiveRectangle;1
2
3
2
3
Parameters
Parameter | Type | Description |
|---|---|---|
bindSchematicPageUuid | string | null | 原理图图页 UUID, |
Returns
矩形图元对象
Remarks
绑定后可在画布上点击该矩形跳转到对应图页
仅在原理图文档中生效,图页 UUID 需为项目树中真实存在的图页节点
本接口对传入值做类型校验,非字符串且非 null 时将抛出错误 ADD since EDA v4.1.103
Example
javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试矩形
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300);
// 3. 获取目标图页的 UUID(取第一个原理图图页)
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pageUuid = pages[0]?.uuid ?? null;
// 4. 绑定图页并提交,绑定后可在画布上点击该矩形跳转到对应图页
const asyncRect = rect.toAsync();
asyncRect.setState_BindSchematicPageUuid(pageUuid);
await asyncRect.done();
// 5. 从画布重新读取,确认绑定已生效
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('bindSchematicPageUuid:', pageUuid, '→', refetched.getState_BindSchematicPageUuid());
// 6. 清理测试图元
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22