Home > ISCH_PrimitiveArc > toSync
ISCH_PrimitiveArc.toSync() method
将图元转换为同步图元
签名
typescript
function toSync(): ISCH_PrimitiveArc;1
返回值
圆弧图元对象
示例
javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧(创建后默认处于异步模式)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 转换为同步图元
const syncArc = arc.toSync();
// 4. 同步模式下修改终点 X,立即生效,无需 done()
syncArc.setState_EndX(x + 300);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('isAsync after toSync:', arc.isAsync());
console.log('endX:', x + 200, '→', refetched.getState_EndX());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18