Home > DMT_Schematic > modifySchematicPageTitleBlock
DMT_Schematic.modifySchematicPageTitleBlock() 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.
Modify the title block of a schematic sheet
Signature
function modifySchematicPageTitleBlock(
showTitleBlock?: boolean,
titleBlockData?: Record<
string,
{ showTitle?: undefined | false | true; showValue?: undefined | false | true; value?: any }
>,
): Promise<boolean>;2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
showTitleBlock | boolean | (Optional) Whether to show the title block. If undefined, the current state will be kept |
titleBlockData | Record<string, { showTitle?: undefined | false | true; showValue?: undefined | false | true; value?: any }> | (Optional) The title block items to be modified and their modified values |
Returns
Promise<boolean>
Whether the modification was successful. If showTitleBlock and titleBlockData are not passed in, false will be returned. Note that if unrecognized title block items exist but the program does not report an error, true will be returned because the unrecognized items are ignored
Remarks
titleBlockData only needs to pass in any title block items to be modified as key, along with the values to modify them to. Any unrecognized title block items will be ignored, and any unpassed items and values will remain in their default state
Example
// 1. 创建专用测试原理图并打开自带图页 p1,让焦点落到目标页上
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const pageUuid = info.page[0].uuid;
await eda.dmt_EditorControl.openDocument(pageUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 修改明细表:显示明细表,并把"公司"改为示例值(三个字段缺一不可)
const modified = await eda.dmt_Schematic.modifySchematicPageTitleBlock(true, {
Company: { showTitle: true, showValue: true, value: '嘉立创示例科技' },
});
console.log('modified:', modified);
// 3. 等 1.5s 同步,回读验证明细项已更新
await new Promise(r => setTimeout(r, 1500));
const after = await eda.dmt_Schematic.getSchematicPageInfo(pageUuid);
console.log('showTitleBlock:', after?.showTitleBlock);
console.log('company:', after?.titleBlockData?.Company?.value);
console.log('modifyVerified:', after?.titleBlockData?.Company?.value === '嘉立创示例科技');
// 4. 清理测试原理图,保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25