Home > SYS_Tool > netlistComparison
SYS_Tool.netlistComparison() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
网表对比
签名
typescript
function netlistComparison(
netlist1: string | { projectUuid: string; documentUuid: string } | File,
netlist2: string | { projectUuid: string; documentUuid: string } | File,
): Promise<
Array<{
type: 'Net' | 'Component';
object: string;
netlist1Name: string[];
netlist2Name: string[];
}>
>;1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
参数名
参数 | 类型 | 描述 |
|---|---|---|
netlist1 | string | { projectUuid: string; documentUuid: string } | File | 网表 1,可以为:①当前工程内的原理图、PCB 的 UUID;②其它工程的工程 UUID 和原理图、PCB UUID;③原理图、PCB 文件数据 |
netlist2 | string | { projectUuid: string; documentUuid: string } | File | 网表 2,可以为:①当前工程内的原理图、PCB 的 UUID;②其它工程的工程 UUID 和原理图、PCB UUID;③原理图、PCB 文件数据 |
返回值
Promise<Array<{ type: 'Net' | 'Component'; object: string; netlist1Name: string[]; netlist2Name: string[] }>>
网表对比结果
示例
javascript
// 1. 取工程内前两张 PCB 作为两份网表的来源
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
const docA = pcbs[0];
const docB = pcbs[1];
// 2. 同一文档与自身对比:网表完全一致,返回空数组(无差异)
const selfDiff = await eda.sys_Tool.netlistComparison(docA.uuid, docA.uuid);
console.log('自身对比差异条数:', selfDiff.length);
// 3. 两张不同 PCB 对比:返回差异清单
const diff = await eda.sys_Tool.netlistComparison(docA.uuid, docB.uuid);
console.log('两文档对比差异条数:', diff.length);
// 4. 展示差异结构:type 为差异类型,object 为差异对象,
// net1 / net2 分别是该对象在两份网表中的名称列表(运行时字段名)
for (const item of diff.slice(0, 5)) {
console.log('差异:', item.type, item.object, '网表 1:', item.net1.join('、') || '(无)', '网表 2:', item.net2.join('、') || '(无)');
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18