Skip to content

Latest commit

 

History

History
845 lines (402 loc) · 11.3 KB

File metadata and controls

845 lines (402 loc) · 11.3 KB

PCB_PrimitiveComponent class

PCB & 封装 / 器件图元类

Signature

declare class PCB_PrimitiveComponent implements IPCB_PrimitiveAPI 

Implements: IPCB_PrimitiveAPI

Methods

Method

Modifiers

Description

create(component, layer, x, y, rotation, primitiveLock)

(BETA) 创建器件

delete(primitiveIds)

(BETA) 删除器件

get(primitiveIds)

(BETA) 获取器件

get(primitiveIds)

(BETA) 获取器件

getAll(layer, primitiveLock)

(BETA) 获取所有器件

getAllPinsByPrimitiveId(primitiveId)

(BETA) 获取器件关联的所有焊盘

getAllPrimitiveId(layer, primitiveLock)

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

modify(primitiveId, property)

(BETA) 修改器件

placeComponentWithMouse(component)

(BETA) 使用鼠标放置器件


方法详情

create

PCB_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 | {
        libraryType: ELIB_LibraryType.FOOTPRINT;
        libraryUuid: string;
        uuid: string;
    } | ILIB_FootprintItem | ILIB_FootprintSearchItem, layer: TPCB_LayersOfComponent, x: number, y: number, rotation?: number, primitiveLock?: boolean): Promise<IPCB_PrimitiveComponent | undefined>;

Parameters

Parameter

Type

Description

component

{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem | { libraryType: ELIB_LibraryType.FOOTPRINT; libraryUuid: string; uuid: string; } | ILIB_FootprintItem | ILIB_FootprintSearchItem

关联库器件

layer

TPCB_LayersOfComponent

x

number

坐标 X

y

number

坐标 Y

rotation

number

(Optional) 旋转角度

primitiveLock

boolean

(Optional) 是否锁定

Returns

Promise<IPCB_PrimitiveComponent | undefined>

器件图元对象

delete

PCB_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 | IPCB_PrimitiveComponent | Array<string> | Array<IPCB_PrimitiveComponent>): Promise<boolean>;

Parameters

Parameter

Type

Description

primitiveIds

string | IPCB_PrimitiveComponent | Array<string> | Array<IPCB_PrimitiveComponent>

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

Returns

Promise<boolean>

删除操作是否成功

get

PCB_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<IPCB_PrimitiveComponent | undefined>;

Parameters

Parameter

Type

Description

primitiveIds

string

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

Returns

Promise<IPCB_PrimitiveComponent | undefined>

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

get_1

PCB_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<IPCB_PrimitiveComponent>>;

Parameters

Parameter

Type

Description

primitiveIds

Array<string>

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

Returns

Promise<Array<IPCB_PrimitiveComponent>>

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

Remarks

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

getall

PCB_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(layer?: TPCB_LayersOfComponent, primitiveLock?: boolean): Promise<Array<IPCB_PrimitiveComponent>>;

Parameters

Parameter

Type

Description

layer

TPCB_LayersOfComponent

(Optional)

primitiveLock

boolean

(Optional) 是否锁定

Returns

Promise<Array<IPCB_PrimitiveComponent>>

器件图元对象数组

getallpinsbyprimitiveid

PCB_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<IPCB_PrimitiveComponentPad> | undefined>;

Parameters

Parameter

Type

Description

primitiveId

string

器件图元 ID

Returns

Promise<Array<IPCB_PrimitiveComponentPad> | undefined>

器件焊盘图元数组

getallprimitiveid

PCB_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(layer?: TPCB_LayersOfComponent, primitiveLock?: boolean): Promise<Array<string>>;

Parameters

Parameter

Type

Description

layer

TPCB_LayersOfComponent

(Optional)

primitiveLock

boolean

(Optional) 是否锁定

Returns

Promise<Array<string>>

器件的图元 ID 数组

modify

PCB_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 | IPCB_PrimitiveComponent, property: {
        layer?: TPCB_LayersOfComponent;
        x?: number;
        y?: number;
        rotation?: number;
        primitiveLock?: boolean;
        addIntoBom?: 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]: any;
        };
    }): Promise<IPCB_PrimitiveComponent | undefined>;

Parameters

Parameter

Type

Description

primitiveId

string | IPCB_PrimitiveComponent

图元 ID

property

{ layer?: TPCB_LayersOfComponent; x?: number; y?: number; rotation?: number; primitiveLock?: boolean; addIntoBom?: 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]: any; }; }

Returns

Promise<IPCB_PrimitiveComponent | undefined>

器件图元对象

placecomponentwithmouse

PCB_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): Promise<boolean>;

Parameters

Parameter

Type

Description

component

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

关联库器件

Returns

Promise<boolean>

是否找到器件

Remarks

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

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