Home > LIB_SimulationModel > copy
LIB_SimulationModel.copy() 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.
Copy the simulation model
Signature
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
Parameters
Parameter | Type | Description |
|---|---|---|
simulationModelUuid | string | Simulation model UUID |
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
targetLibraryUuid | string | Target library UUID |
targetClassification | Array<string> | (Optional) Classification in the target library |
newSimulationModelName | string | (Optional) New simulation model name. If a symbol with the same name exists in the target library, the copy will fail |
Returns
Promise<string | undefined>
UUID of the new simulation model in the target library
Remarks
ADD since EDA v3.2.167
Example
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