Home > LIB_SimulationModel > copy
LIB_SimulationModel.copy() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
复制仿真模型
签名
typescript
function copy(
simulationModelUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: Array<string>,
newSimulationModelName?: string,
): Promise<string | undefined>;1
2
3
4
5
6
7
2
3
4
5
6
7
参数名
参数 | 类型 | 描述 |
|---|---|---|
simulationModelUuid | string | 仿真模型 UUID |
libraryUuid | string | 库 UUID,可以使用 LIB_LibrariesList 内的接口获取 |
targetLibraryUuid | string | 目标库 UUID |
targetClassification | Array<string> | (可选) 目标库内的分类 |
newSimulationModelName | string | (可选) 新仿真模型名称,如若目标库内存在重名符号将导致复制失败 |
返回值
Promise<string | undefined>
目标库内新仿真模型的 UUID
备注
ADD since EDA v3.2.167
示例
javascript
// 1. 获取个人库 UUID,并新建一个仿真模型作为复制来源
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const sourceName = `嘉立创示例_仿真模型来源_${Date.now()}`;
const sourceUuid = await eda.lib_SimulationModel.create(libraryUuid, {
modelType: 'Ngspice',
modelData: '* 示例电阻模型\n.model EXAMPLE_RES RES(R=1k)\n',
modelName: sourceName,
});
// 2. 同库复制,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_仿真模型副本_${Date.now()}`;
const copiedUuid = await eda.lib_SimulationModel.copy(
sourceUuid,
libraryUuid,
libraryUuid,
[],
newName
);
// 创建类保留现场(副本留在个人库中供观察)
console.log('sourceUuid:', sourceUuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24