PCB & 封装 / 器件图元类
declare class PCB_PrimitiveComponent implements IPCB_PrimitiveAPI Implements: IPCB_PrimitiveAPI
|
Method |
Modifiers |
Description |
|---|---|---|
|
(BETA) 创建器件 | ||
|
(BETA) 删除器件 | ||
|
(BETA) 获取器件 | ||
|
(BETA) 获取器件 | ||
|
(BETA) 获取所有器件 | ||
|
(BETA) 获取器件关联的所有焊盘 | ||
|
(BETA) 获取所有器件的图元 ID | ||
|
(BETA) 修改器件 | ||
|
(BETA) 使用鼠标放置器件 |
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(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>;|
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 |
层 | |
|
x |
number |
坐标 X |
|
y |
number |
坐标 Y |
|
rotation |
number |
(Optional) 旋转角度 |
|
primitiveLock |
boolean |
(Optional) 是否锁定 |
Promise<IPCB_PrimitiveComponent | undefined>
器件图元对象
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.
删除器件
delete(primitiveIds: string | IPCB_PrimitiveComponent | Array<string> | Array<IPCB_PrimitiveComponent>): Promise<boolean>;|
Parameter |
Type |
Description |
|---|---|---|
|
primitiveIds |
string | IPCB_PrimitiveComponent | Array<string> | Array<IPCB_PrimitiveComponent> |
器件的图元 ID 或器件图元对象 |
Promise<boolean>
删除操作是否成功
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.
获取器件
get(primitiveIds: string): Promise<IPCB_PrimitiveComponent | undefined>;|
Parameter |
Type |
Description |
|---|---|---|
|
primitiveIds |
string |
器件的图元 ID,可以为字符串或字符串数组,如若为数组,则返回的也是数组 |
Promise<IPCB_PrimitiveComponent | undefined>
器件图元对象,undefined 表示获取失败
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.
获取器件
get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveComponent>>;|
Parameter |
Type |
Description |
|---|---|---|
|
primitiveIds |
Array<string> |
器件的图元 ID,可以为字符串或字符串数组,如若为数组,则返回的也是数组 |
Promise<Array<IPCB_PrimitiveComponent>>
器件图元对象,空数组表示获取失败
如若传入多个图元 ID,任意图元 ID 未匹配到不影响其它图元的返回,即可能返回少于传入的图元 ID 数量的图元对象
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.
获取所有器件
getAll(layer?: TPCB_LayersOfComponent, primitiveLock?: boolean): Promise<Array<IPCB_PrimitiveComponent>>;|
Parameter |
Type |
Description |
|---|---|---|
|
layer |
(Optional) 层 | |
|
primitiveLock |
boolean |
(Optional) 是否锁定 |
Promise<Array<IPCB_PrimitiveComponent>>
器件图元对象数组
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.
获取器件关联的所有焊盘
getAllPinsByPrimitiveId(primitiveId: string): Promise<Array<IPCB_PrimitiveComponentPad> | undefined>;|
Parameter |
Type |
Description |
|---|---|---|
|
primitiveId |
string |
器件图元 ID |
Promise<Array<IPCB_PrimitiveComponentPad> | undefined>
器件焊盘图元数组
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
getAllPrimitiveId(layer?: TPCB_LayersOfComponent, primitiveLock?: boolean): Promise<Array<string>>;|
Parameter |
Type |
Description |
|---|---|---|
|
layer |
(Optional) 层 | |
|
primitiveLock |
boolean |
(Optional) 是否锁定 |
Promise<Array<string>>
器件的图元 ID 数组
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.
修改器件
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>;|
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; }; } |
Promise<IPCB_PrimitiveComponent | undefined>
器件图元对象
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.
使用鼠标放置器件
placeComponentWithMouse(component: {
libraryUuid: string;
uuid: string;
} | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;|
Parameter |
Type |
Description |
|---|---|---|
|
component |
{ libraryUuid: string; uuid: string; } | ILIB_DeviceItem | ILIB_DeviceSearchItem |
关联库器件 |
Promise<boolean>
是否找到器件
本接口模拟前端点击放置按钮,指定的器件将绑定到当前鼠标,并在用户后续点击时放置于画布
本接口的返回时机并不会等待用户的放置操作,一旦器件被绑定到鼠标,本接口将立即返回 true 的结果