Home > SCH_Primitive > getPrimitiveTypeByPrimitiveId
SCH_Primitive.getPrimitiveTypeByPrimitiveId() 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.
Get the primitive type of the primitive with the specified ID
Signature
typescript
function getPrimitiveTypeByPrimitiveId(id: string): Promise<ESCH_PrimitiveType | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
id | string | Primitive ID |
Returns
Promise<ESCH_PrimitiveType | undefined>
Primitive type
Example
javascript
// 1. 创建一条测试导线作为查询目标(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000], 'SIG_A');
// 2. 用图元 ID 查询类型
const type = await eda.sch_Primitive.getPrimitiveTypeByPrimitiveId(wire.getState_PrimitiveId());
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('primitiveType:', type);1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10