Home > PCB_PrimitiveArc > modify
PCB_PrimitiveArc.modify() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
修改圆弧线
签名
typescript
function modify(
primitiveId: string | IPCB_PrimitiveArc,
property: {
net?: string;
layer?: TPCB_LayersOfLine;
startX?: number;
startY?: number;
endX?: number;
endY?: number;
arcAngle?: number;
lineWidth?: number;
interactiveMode?: EPCB_PrimitiveArcInteractiveMode;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveArc | undefined>;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
参数名
参数 | 类型 | 描述 |
|---|---|---|
primitiveId | string | IPCB_PrimitiveArc | 图元 ID |
property | { net?: string; layer?: TPCB_LayersOfLine; startX?: number; startY?: number; endX?: number; endY?: number; arcAngle?: number; lineWidth?: number; interactiveMode?: EPCB_PrimitiveArcInteractiveMode; primitiveLock?: boolean } | 修改参数 |
返回值
Promise<IPCB_PrimitiveArc | undefined>
圆弧线图元对象
备注
property.arcAngle 合法域为 0 < |arcAngle| < 360,不支持 0° 或 ±360° 整圆:两点式圆弧无法表达整圆,传入将抛错
示例
javascript
// 1. 创建待修改的测试圆弧(随机坐标避免与画布已有圆弧重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
const arcId = arc.getState_PrimitiveId();
// 2. 读取修改前的线宽与圆心角
const beforeWidth = arc.getState_LineWidth();
const beforeAngle = arc.getState_ArcAngle();
// 3. 批量修改:线宽 10 → 24,圆心角 90 → 120
await eda.pcb_PrimitiveArc.modify(arcId, { lineWidth: 24, arcAngle: 120 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveArc.get(arcId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', arcId);
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('arcAngle:', beforeAngle, '→', refreshed.getState_ArcAngle());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20