Skip to content

Latest commit

 

History

History
1880 lines (881 loc) · 23.6 KB

File metadata and controls

1880 lines (881 loc) · 23.6 KB

SCH_PrimitiveComponent class

原理图 & 符号 / 器件图元类

Signature

declare class SCH_PrimitiveComponent implements ISCH_PrimitiveAPI 

Implements: ISCH_PrimitiveAPI

Remarks

Methods

Method

Modifiers

Description

create(component, x, y, subPartName, rotation, mirror, addIntoBom, addIntoPcb)

(BETA) 创建器件

createNetFlag(identification, net, x, y, rotation, mirror)

(BETA) 创建网络标识

createNetPort(direction, net, x, y, rotation, mirror)

(BETA) 创建网络端口

createShortCircuitFlag(x, y, rotation, mirror)

(BETA) 创建短接标识

delete(primitiveIds)

(BETA) 删除器件

get(primitiveIds)

(BETA) 获取器件

get(primitiveIds)

(BETA) 获取器件

getAll(componentType, allSchematicPages)

(BETA) 获取所有器件

getAllPinsByPrimitiveId(primitiveId)

(BETA) 获取器件关联的所有引脚

getAllPrimitiveId(componentType, allSchematicPages)

(BETA) 获取所有器件的图元 ID

getAllPropertyNames()

(BETA) 获取所有器件的所有属性名称集合

modify(primitiveId, property)

(BETA) 修改器件

placeComponentWithMouse(component, subPartName)

(BETA) 使用鼠标放置器件

setNetFlagComponentUuid_AnalogGround(component)

(BETA) 设置在扩展 API 中 AnalogGround 网络标识关联的器件 UUID

setNetFlagComponentUuid_Ground(component)

(BETA) 设置在扩展 API 中 Ground 网络标识关联的器件 UUID

setNetFlagComponentUuid_Power(component)

(BETA) 设置在扩展 API 中 Power 网络标识关联的器件 UUID

setNetFlagComponentUuid_ProtectGround(component)

(BETA) 设置在扩展 API 中 ProtectGround 网络标识关联的器件 UUID

setNetPortComponentUuid_BI(component)

(BETA) 设置在扩展 API 中 BI 网络端口关联的器件 UUID

setNetPortComponentUuid_IN(component)

(BETA) 设置在扩展 API 中 IN 网络端口关联的器件 UUID

setNetPortComponentUuid_OUT(component)

(BETA) 设置在扩展 API 中 OUT 网络端口关联的器件 UUID


方法详情

create

SCH_PrimitiveComponent.create() 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.

创建器件

Signature

create(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem, x: number, y: number, subPartName?: string, rotation?: number, mirror?: boolean, addIntoBom?: boolean, addIntoPcb?: boolean): Promise<ISCH_PrimitiveComponent$1 | undefined>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

x

number

坐标 X

y

number

坐标 Y

subPartName

string

(Optional) 子图块名称

rotation

number

(Optional) 旋转角度

mirror

boolean

(Optional) 是否镜像

addIntoBom

boolean

(Optional) 是否加入 BOM

addIntoPcb

boolean

(Optional) 是否转到 PCB

Returns

Promise<ISCH_PrimitiveComponent$1 | undefined>

器件图元对象

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.

创建网络标识

Signature

createNetFlag(identification: 'Power' | 'Ground' | 'AnalogGround' | 'ProtectGround', net: string, x: number, y: number, rotation?: number, mirror?: boolean): Promise<ISCH_PrimitiveComponent$1 | undefined>;

Parameters

Parameter

Type

Description

identification

'Power' | 'Ground' | 'AnalogGround' | 'ProtectGround'

标识类型

net

string

网络名称

x

number

坐标 X

y

number

坐标 Y

rotation

number

(Optional) 旋转角度

mirror

boolean

(Optional) 是否镜像

Returns

Promise<ISCH_PrimitiveComponent$1 | undefined>

器件图元对象

createnetport

SCH_PrimitiveComponent.createNetPort() 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.

创建网络端口

Signature

createNetPort(direction: 'IN' | 'OUT' | 'BI', net: string, x: number, y: number, rotation?: number, mirror?: boolean): Promise<ISCH_PrimitiveComponent$1 | undefined>;

Parameters

Parameter

Type

Description

direction

'IN' | 'OUT' | 'BI'

端口方向

net

string

网络名称

x

number

坐标 X

y

number

坐标 Y

rotation

number

(Optional) 旋转角度

mirror

boolean

(Optional) 是否镜像

Returns

Promise<ISCH_PrimitiveComponent$1 | undefined>

器件图元对象

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.

创建短接标识

Signature

createShortCircuitFlag(x: number, y: number, rotation?: number, mirror?: boolean): Promise<ISCH_PrimitiveComponent$1 | undefined>;

Parameters

Parameter

Type

Description

x

number

坐标 X

y

number

坐标 Y

rotation

number

(Optional) 旋转角度

mirror

boolean

(Optional) 是否镜像

Returns

Promise<ISCH_PrimitiveComponent$1 | undefined>

器件图元对象

delete

SCH_PrimitiveComponent.delete() 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.

删除器件

Signature

delete(primitiveIds: string | ISCH_PrimitiveComponent$1 | Array<string> | Array<ISCH_PrimitiveComponent$1>): Promise<boolean>;

Parameters

Parameter

Type

Description

primitiveIds

string | ISCH_PrimitiveComponent$1 | Array<string> | Array<ISCH_PrimitiveComponent$1>

器件的图元 ID 或器件图元对象

Returns

Promise<boolean>

删除操作是否成功

get

SCH_PrimitiveComponent.get() 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.

获取器件

Signature

get(primitiveIds: string): Promise<ISCH_PrimitiveComponent$1 | undefined>;

Parameters

Parameter

Type

Description

primitiveIds

string

器件的图元 ID,可以为字符串或字符串数组,如若为数组,则返回的也是数组

Returns

Promise<ISCH_PrimitiveComponent$1 | undefined>

器件图元对象,undefined 表示获取失败

get_1

SCH_PrimitiveComponent.get() 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.

获取器件

Signature

get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveComponent$1>>;

Parameters

Parameter

Type

Description

primitiveIds

Array<string>

器件的图元 ID,可以为字符串或字符串数组,如若为数组,则返回的也是数组

Returns

Promise<Array<ISCH_PrimitiveComponent$1>>

器件图元对象,空数组表示获取失败

Remarks

如若传入多个图元 ID,任意图元 ID 未匹配到不影响其它图元的返回,即可能返回少于传入的图元 ID 数量的图元对象

getall

SCH_PrimitiveComponent.getAll() 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.

获取所有器件

Signature

getAll(componentType?: ESCH_PrimitiveComponentType$1, allSchematicPages?: boolean): Promise<Array<ISCH_PrimitiveComponent$1>>;

Parameters

Parameter

Type

Description

componentType

ESCH_PrimitiveComponentType$1

(Optional) 器件类型

allSchematicPages

boolean

(Optional) 是否获取所有原理图图页的器件

Returns

Promise<Array<ISCH_PrimitiveComponent$1>>

器件图元对象数组

getallpinsbyprimitiveid

SCH_PrimitiveComponent.getAllPinsByPrimitiveId() 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.

获取器件关联的所有引脚

Signature

getAllPinsByPrimitiveId(primitiveId: string): Promise<Array<ISCH_PrimitiveComponentPin> | undefined>;

Parameters

Parameter

Type

Description

primitiveId

string

器件图元 ID

Returns

Promise<Array<ISCH_PrimitiveComponentPin> | undefined>

器件引脚图元数组

getallprimitiveid

SCH_PrimitiveComponent.getAllPrimitiveId() 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.

获取所有器件的图元 ID

Signature

getAllPrimitiveId(componentType?: ESCH_PrimitiveComponentType$1, allSchematicPages?: boolean): Promise<Array<string>>;

Parameters

Parameter

Type

Description

componentType

ESCH_PrimitiveComponentType$1

(Optional) 器件类型

allSchematicPages

boolean

(Optional) 是否获取所有原理图图页的器件

Returns

Promise<Array<string>>

器件的图元 ID 数组

getallpropertynames

SCH_PrimitiveComponent.getAllPropertyNames() 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.

获取所有器件的所有属性名称集合

Signature

getAllPropertyNames(): Promise<Array<string>>;

Returns

Promise<Array<string>>

所有器件的所有属性名称集合

modify

SCH_PrimitiveComponent.modify() 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.

修改器件

Signature

modify(primitiveId: string | ISCH_PrimitiveComponent$1, property: {
        x?: number;
        y?: number;
        rotation?: number;
        mirror?: boolean;
        addIntoBom?: boolean;
        addIntoPcb?: boolean;
        designator?: string | null;
        name?: string | null;
        uniqueId?: string | null;
        manufacturer?: string | null;
        manufacturerId?: string | null;
        supplier?: string | null;
        supplierId?: string | null;
        otherProperty?: {
            [key: string]: string | number | boolean;
        };
    }): Promise<ISCH_PrimitiveComponent$1 | undefined>;

Parameters

Parameter

Type

Description

primitiveId

string | ISCH_PrimitiveComponent$1

图元 ID

property

{ x?: number; y?: number; rotation?: number; mirror?: boolean; addIntoBom?: boolean; addIntoPcb?: boolean; designator?: string | null; name?: string | null; uniqueId?: string | null; manufacturer?: string | null; manufacturerId?: string | null; supplier?: string | null; supplierId?: string | null; otherProperty?: { [key: string]: string | number | boolean; }; }

Returns

Promise<ISCH_PrimitiveComponent$1 | undefined>

器件图元对象

Remarks

仅当器件类型为 COMPONENT 时允许使用该方法进行修改

placecomponentwithmouse

SCH_PrimitiveComponent.placeComponentWithMouse() 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.

使用鼠标放置器件

Signature

placeComponentWithMouse(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem, subPartName?: string): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

subPartName

string

(Optional)

Returns

Promise<boolean>

是否找到器件

Remarks

本接口模拟前端点击放置按钮,指定的器件将绑定到当前鼠标,并在用户后续点击时放置于画布

本接口的返回时机并不会等待用户的放置操作,一旦器件被绑定到鼠标,本接口将立即返回 true 的结果

setnetflagcomponentuuid_analogground

SCH_PrimitiveComponent.setNetFlagComponentUuid_AnalogGround() 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.

设置在扩展 API 中 AnalogGround 网络标识关联的器件 UUID

Signature

setNetFlagComponentUuid_AnalogGround(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

Returns

Promise<boolean>

操作是否成功

setnetflagcomponentuuid_ground

SCH_PrimitiveComponent.setNetFlagComponentUuid_Ground() 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.

设置在扩展 API 中 Ground 网络标识关联的器件 UUID

Signature

setNetFlagComponentUuid_Ground(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

Returns

Promise<boolean>

操作是否成功

setnetflagcomponentuuid_power

SCH_PrimitiveComponent.setNetFlagComponentUuid_Power() 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.

设置在扩展 API 中 Power 网络标识关联的器件 UUID

Signature

setNetFlagComponentUuid_Power(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

Returns

Promise<boolean>

操作是否成功

setnetflagcomponentuuid_protectground

SCH_PrimitiveComponent.setNetFlagComponentUuid_ProtectGround() 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.

设置在扩展 API 中 ProtectGround 网络标识关联的器件 UUID

Signature

setNetFlagComponentUuid_ProtectGround(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

Returns

Promise<boolean>

操作是否成功

setnetportcomponentuuid_bi

SCH_PrimitiveComponent.setNetPortComponentUuid_BI() 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.

设置在扩展 API 中 BI 网络端口关联的器件 UUID

Signature

setNetPortComponentUuid_BI(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

Returns

Promise<boolean>

操作是否成功

setnetportcomponentuuid_in

SCH_PrimitiveComponent.setNetPortComponentUuid_IN() 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.

设置在扩展 API 中 IN 网络端口关联的器件 UUID

Signature

setNetPortComponentUuid_IN(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

Returns

Promise<boolean>

操作是否成功

setnetportcomponentuuid_out

SCH_PrimitiveComponent.setNetPortComponentUuid_OUT() 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.

设置在扩展 API 中 OUT 网络端口关联的器件 UUID

Signature

setNetPortComponentUuid_OUT(component: {
        libraryUuid: string;
        uuid: string;
    } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem

关联库器件

Returns

Promise<boolean>

操作是否成功