Home > SCH_PrimitiveComponent > createNetFlag
SCH_PrimitiveComponent.createNetFlag() 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 Net flag
Signature
typescript
function createNetFlag(
identification: 'Power' | 'Ground' | 'AnalogGround' | 'ProtectGround',
net: string,
x: number,
y: number,
rotation?: number,
mirror?: boolean,
): Promise<ISCH_PrimitiveComponent | undefined>;1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Parameters
Parameter | Type | Description |
|---|---|---|
identification | 'Power' | 'Ground' | 'AnalogGround' | 'ProtectGround' | Identification type |
net | string | Net name |
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. 创建 Power 类型的网络标识,网络名为 VCC
const flag = await eda.sch_PrimitiveComponent.createNetFlag(
'Power', // 标识类型:'Power' / 'Ground' / 'AnalogGround' / 'ProtectGround'
'嘉立创示例_VCC', // 网络名称
x, // 坐标 X
y, // 坐标 Y
0, // 旋转角度
false // 是否镜像
);
// 3. 创建类保留现场,供在画布上观察标识样式
console.log('primitiveId:', flag.getState_PrimitiveId());
console.log('net:', flag.getState_Net());
console.log('componentType:', flag.getState_ComponentType());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