Home > LIB_3DModel > create
LIB_3DModel.create() 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.
Create 3D model
Signature
typescript
function create(
libraryUuid: string,
modelFile: Blob,
classification?: ILIB_ClassificationIndex | Array<string>,
unit?:
| ESYS_Unit.MILLIMETER
| ESYS_Unit.CENTIMETER
| ESYS_Unit.METER
| ESYS_Unit.MIL
| ESYS_Unit.INCH,
): Promise<Array<string> | undefined>;1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Parameters
Parameter | Type | Description |
|---|---|---|
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
modelFile | Blob | 3D model file data |
classification | ILIB_ClassificationIndex | Array<string> | (Optional) Classification |
unit | ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.METER | ESYS_Unit.MIL | ESYS_Unit.INCH | (Optional) Unit |
Returns
Promise<Array<string> | undefined>
UUIDs of all created 3D models
Remarks
The passed-in modelFile can be an archive of multiple model files. EDA will automatically extract the multiple models
Example
javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 构造一个单面片的 ASCII STL 模型文件
const stl = [
'solid example',
'facet normal 0 0 1',
'outer loop',
'vertex 0 0 0',
'vertex 10 0 0',
'vertex 0 10 0',
'endloop',
'endfacet',
'endsolid example',
].join('\n');
const blob = new Blob([stl], { type: 'model/stl' });
// 3. 导入到个人库,模型单位为毫米
const modelUuids = await eda.lib_3DModel.create(libraryUuid, blob, [], 'mm');
// 创建类保留现场
console.log('libraryUuid:', libraryUuid);
console.log('created:', modelUuids ? modelUuids.length : 0);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