Home > SCH_PrimitiveComponent > createShortCircuitFlag
SCH_PrimitiveComponent.createShortCircuitFlag() 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.
Create a short circuit flag
Signature
typescript
function createShortCircuitFlag(
x: number,
y: number,
rotation?: number,
mirror?: boolean,
): Promise<ISCH_PrimitiveComponent | undefined>;1
2
3
4
5
6
2
3
4
5
6
Parameters
Parameter | Type | Description |
|---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
rotation | number | (Optional) Rotation angle |
mirror | boolean | (Optional) Whether it is mirrored |
Returns
Promise<ISCH_PrimitiveComponent | undefined>
Device primitive object
Example
javascript
// 1. 随机坐标避免与画布已有图元重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建短接标识(无网络名参数,仅位置与姿态)
const flag = await eda.sch_PrimitiveComponent.createShortCircuitFlag(
x, // 坐标 X
y, // 坐标 Y
0, // 旋转角度
false // 是否镜像
);
// 3. 创建类保留现场,供在画布上观察标识样式
console.log('primitiveId:', flag.getState_PrimitiveId());
console.log('componentType:', flag.getState_ComponentType());
console.log('position:', flag.getState_X(), ',', flag.getState_Y());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16