Home > DMT_EditorControl > generateIndicatorMarkers
DMT_EditorControl.generateIndicatorMarkers() 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.
Generate indicator markers
Signature
function generateIndicatorMarkers(
markers: Array<IDMT_IndicatorMarkerShape>,
color?: { r: number; g: number; b: number; alpha: number },
lineWidth?: number,
zoom?: boolean,
tabId?: string,
): Promise<boolean>;2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
markers | Array<IDMT_IndicatorMarkerShape> | Array of indicator marker shape objects |
color | { r: number; g: number; b: number; alpha: number } | (Optional) Indicator marker color |
lineWidth | number | (Optional) Line width |
zoom | boolean | (Optional) Whether to locate and zoom |
tabId | string | (Optional) Tab ID. If not passed in, the canvas with the last input focus will be used |
Returns
Promise<boolean>
Whether the indicator markers were generated successfully, false indicates that the canvas does not support this operation or tabId does not exist
Remarks
In the indicator marker shape data, the coordinate unit span of the schematic and symbol canvases is 0.01inch, and that of the PCB and footprint canvases is mil
Example
// 1. 打开一个原理图页,确定标记作用的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 生成一组标记:点 + 圆 + 矩形(原理图画布坐标单位 0.01inch)
const generated = await eda.dmt_EditorControl.generateIndicatorMarkers(
[
{ type: 'point', x: 100, y: 100 },
{ type: 'circle', x: 250, y: 150, r: 50 },
{ type: 'rectangle', left: 350, right: 550, top: 100, bottom: 250 },
],
{ r: 255, g: 60, b: 60, alpha: 1 }, // 标记颜色
2, // 线宽
false, // 不自动缩放定位到标记
tabId,
);
console.log('generated:', generated);
// 3. 用完即清,保持画布干净
const removed = await eda.dmt_EditorControl.removeIndicatorMarkers(tabId);
console.log('removed:', removed);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21