Home > SCH_PrimitiveRectangle > getAll
SCH_PrimitiveRectangle.getAll() method
Get all Rectangle
Signature
typescript
function getAll(): Promise<Array<ISCH_PrimitiveRectangle>>;1
Returns
Promise<Array<ISCH_PrimitiveRectangle>>
Array of Rectangle primitive objects
Example
javascript
// 1. 创建一个测试矩形作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300, 0, 0, '#FF0000');
const rectId = rect.getState_PrimitiveId();
// 2. 获取当前原理图页的全部矩形
const all = await eda.sch_PrimitiveRectangle.getAll();
// 3. 清理测试矩形(查询类需要清理)
await eda.sch_PrimitiveRectangle.delete([rectId]);
console.log('total rectangles:', all.length);
console.log('marker rectangle found:', all.some(r => r.getState_PrimitiveId() === rectId));
console.log('marker color:', all.find(r => r.getState_PrimitiveId() === rectId).getState_Color());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15