SCH_Drc.check() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
检查 DRC
签名
typescript
function check(
strict: boolean,
userInterface: boolean,
includeVerboseError: false,
): Promise<boolean>;1
2
3
4
5
2
3
4
5
参数名
参数 | 类型 | 描述 |
|---|---|---|
strict | boolean | 是否严格检查,当前原理图统一为严格检查模式 |
userInterface | boolean | 是否显示 UI(呼出底部 DRC 窗口) |
includeVerboseError | false | 是否在返回值中包含详细错误信息,如若为 |
返回值
Promise<boolean>
DRC 检查是否通过
示例
javascript
// 1. 创建测试原理图并打开(DRC 作用于当前激活的原理图)
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 详细模式:返回全部违规项,无违规则为空数组
const violations = await eda.sch_Drc.check(true, false, true);
console.log('violationCount:', violations.length);
violations.forEach((v, i) => {
console.log(`[${i}]`, typeof v === 'string' ? v : JSON.stringify(v));
});
// 3. 布尔模式:只返回是否全部通过
const passed = await eda.sch_Drc.check(true, false, false);
console.log('allPassed:', passed);
// 4. 清理测试原理图
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21