@inweb/client 26.5.2 → 26.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +79 -58
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +13 -8
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +1 -1
- package/lib/Api/Client.d.ts +28 -14
- package/lib/Api/File.d.ts +32 -32
- package/lib/Api/Job.d.ts +10 -3
- package/package.json +2 -2
- package/src/Api/Assembly.ts +1 -1
- package/src/Api/Client.ts +43 -21
- package/src/Api/File.ts +32 -32
- package/src/Api/Job.ts +10 -3
package/lib/Api/Assembly.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class Assembly extends Endpoint {
|
|
|
48
48
|
/**
|
|
49
49
|
* Assembly geometry data type:
|
|
50
50
|
*
|
|
51
|
-
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` viewer.
|
|
51
|
+
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` 3D viewer.
|
|
52
52
|
*
|
|
53
53
|
* Returns an empty string if the geometry data is not yet ready.
|
|
54
54
|
*/
|
package/lib/Api/Client.d.ts
CHANGED
|
@@ -312,13 +312,17 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
312
312
|
* generally retrieved from a {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList}
|
|
313
313
|
* object returned as a result of a user selecting files using the HTML `<input>` element.
|
|
314
314
|
* @param params - An object containing upload parameters.
|
|
315
|
-
* @param params.geometry -
|
|
315
|
+
* @param params.geometry - Run File Converter job to convert geometry data after uploading the file.
|
|
316
|
+
* Can be:
|
|
316
317
|
*
|
|
317
|
-
* - `true` - Convert file geometry data to `VSFX` format
|
|
318
|
-
* - `vsfx` - Convert file geometry data to `VSFX` format
|
|
319
|
-
* - `gltf` - Convert file geometry data to `glTF` format
|
|
318
|
+
* - `true` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
319
|
+
* - `vsfx` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
320
|
+
* - `gltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
320
321
|
*
|
|
321
|
-
* @param params.properties -
|
|
322
|
+
* @param params.properties - Run File Converter job to extract properties after uploading the file.
|
|
323
|
+
* @param params.jobParameters - Parameters for the File Converter tool. Use this to specify aditional
|
|
324
|
+
* parameters for retrieving the geometry and properties of uploaded file. Can be given as command
|
|
325
|
+
* line arguments in form `--arg=value`.
|
|
322
326
|
* @param params.waitForDone - Wait for geometry and properties jobs to complete.
|
|
323
327
|
* @param params.timeout - The time, in milliseconds that the function should wait jobs. If no one jobs
|
|
324
328
|
* are done during this time, the `TimeoutError` exception will be thrown.
|
|
@@ -332,6 +336,10 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
332
336
|
uploadFile(file: globalThis.File, params?: {
|
|
333
337
|
geometry?: boolean | string;
|
|
334
338
|
properties?: boolean;
|
|
339
|
+
jobParameters?: {
|
|
340
|
+
geometry?: string | object;
|
|
341
|
+
properties?: string | object;
|
|
342
|
+
};
|
|
335
343
|
waitForDone?: boolean;
|
|
336
344
|
timeout?: number;
|
|
337
345
|
interval?: number;
|
|
@@ -396,18 +404,17 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
396
404
|
* Runs a new job on the server for the sepecified file.
|
|
397
405
|
*
|
|
398
406
|
* @param fileId - File ID.
|
|
399
|
-
* @param outputFormat - The job type. Can be
|
|
407
|
+
* @param outputFormat - The job type. Can be:
|
|
400
408
|
*
|
|
401
|
-
* - `geometry` - Convert file geometry data to `VSFX` format
|
|
402
|
-
* - `geometryGltf` - Convert file geometry data to `glTF` format
|
|
409
|
+
* - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
410
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
403
411
|
* - `properties` - Extract file properties.
|
|
404
|
-
* - `validation` - Validate the
|
|
405
|
-
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the
|
|
406
|
-
* - Other custom job name. Custom job
|
|
407
|
-
* creating a job.
|
|
412
|
+
* - `validation` - Validate the IFC file.
|
|
413
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
414
|
+
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
408
415
|
*
|
|
409
|
-
* @param parameters - Parameters for the job
|
|
410
|
-
*
|
|
416
|
+
* @param parameters - Parameters for the File Converter tool or custom job application. Can be given
|
|
417
|
+
* as command line arguments in form `--arg=value`.
|
|
411
418
|
*/
|
|
412
419
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
413
420
|
/**
|
|
@@ -460,6 +467,9 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
460
467
|
* @param files - List of file IDs.
|
|
461
468
|
* @param name - Assembly name.
|
|
462
469
|
* @param params - Additional assembly creating parameters.
|
|
470
|
+
* @param params.jobParameters - Parameters for the File Converter tool. Use this to specify aditional
|
|
471
|
+
* parameters for generating the geometry and properties of the new assembly. Can be given as command
|
|
472
|
+
* line arguments in form `--arg=value`.
|
|
463
473
|
* @param params.waitForDone - Wait for assembly to be created.
|
|
464
474
|
* @param params.timeout - The time, in milliseconds, that the function should wait for the assembly to
|
|
465
475
|
* be created. If the assembly is not created within this time, a TimeoutError exception will be
|
|
@@ -472,6 +482,10 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
472
482
|
* @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
|
|
473
483
|
*/
|
|
474
484
|
createAssembly(files: string[], name: string, params?: {
|
|
485
|
+
jobParameters?: {
|
|
486
|
+
geometry?: string | object;
|
|
487
|
+
properties?: string | object;
|
|
488
|
+
};
|
|
475
489
|
waitForDone?: boolean;
|
|
476
490
|
timeout?: number;
|
|
477
491
|
interval?: number;
|
package/lib/Api/File.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class File extends Endpoint {
|
|
|
48
48
|
/**
|
|
49
49
|
* Returns a list of file formats in which the active version of the file was exported.
|
|
50
50
|
*
|
|
51
|
-
* To export file to one of the supported formats
|
|
51
|
+
* To export file to one of the supported formats run the File Converter job using
|
|
52
52
|
* {@link createJob | createJob()}. To download exported file use
|
|
53
53
|
* {@link downloadResource | downloadResource()}.
|
|
54
54
|
*
|
|
@@ -60,8 +60,8 @@ export declare class File extends Endpoint {
|
|
|
60
60
|
/**
|
|
61
61
|
* Geometry data type of the active file version. Can be one of:
|
|
62
62
|
*
|
|
63
|
-
* - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` viewer.
|
|
64
|
-
* - `gltf` - `glTF` format, file can be opened in `Three.js` viewer.
|
|
63
|
+
* - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` 3D viewer.
|
|
64
|
+
* - `gltf` - `glTF` format, file can be opened in `Three.js` 3D viewer.
|
|
65
65
|
*
|
|
66
66
|
* Returns an empty string if geometry data has not yet been converted. A files without geometry data
|
|
67
67
|
* can be exported to other formas, but cannot be opened in viewer.
|
|
@@ -329,15 +329,15 @@ export declare class File extends Endpoint {
|
|
|
329
329
|
* Downloads a resource file of the active version of the file. Resource files are files that contain
|
|
330
330
|
* model scene descriptions, or geometry data, or exported files.
|
|
331
331
|
*
|
|
332
|
-
* @example Export file to
|
|
332
|
+
* @example Export file to PDF.
|
|
333
333
|
*
|
|
334
334
|
* ```javascript
|
|
335
|
-
* const job = await file.
|
|
335
|
+
* const job = await file.createJob("pdf");
|
|
336
336
|
* await job.waitForDone();
|
|
337
|
-
* const
|
|
338
|
-
* const arrayBuffer = await file.downloadResource(
|
|
337
|
+
* const pdfResourceName = file.exports.find((x) => x.endsWith(".pdf"));
|
|
338
|
+
* const arrayBuffer = await file.downloadResource(pdfResourceName);
|
|
339
339
|
* const blob = new Blob([arrayBuffer]);
|
|
340
|
-
* const fileName = file.name + ".
|
|
340
|
+
* const fileName = file.name + ".pdf";
|
|
341
341
|
* FileSaver.saveAs(blob, fileName);
|
|
342
342
|
* ```
|
|
343
343
|
*
|
|
@@ -399,59 +399,59 @@ export declare class File extends Endpoint {
|
|
|
399
399
|
/**
|
|
400
400
|
* Runs a new job on the server for the active version of the file.
|
|
401
401
|
*
|
|
402
|
-
* @param outputFormat - The job type. Can be
|
|
402
|
+
* @param outputFormat - The job type. Can be:
|
|
403
403
|
*
|
|
404
|
-
* - `geometry` - Convert file geometry data to `VSFX` format
|
|
405
|
-
* - `geometryGltf` - Convert file geometry data to `glTF` format
|
|
404
|
+
* - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
405
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
406
406
|
* - `properties` - Extract file properties.
|
|
407
|
-
* - `validation` - Validate the
|
|
408
|
-
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the
|
|
409
|
-
*
|
|
407
|
+
* - `validation` - Validate the IFC file.
|
|
408
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format. Use
|
|
409
|
+
* {@link exports} to get the list of completed file exports. Use
|
|
410
410
|
* {@link downloadResource | downloadResource()} to download the exported file.
|
|
411
|
-
* - Other custom job name. Custom job
|
|
412
|
-
* job.
|
|
411
|
+
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
413
412
|
*
|
|
414
|
-
* @param parameters - Parameters for the job
|
|
415
|
-
*
|
|
413
|
+
* @param parameters - Parameters for the File Converter tool or custom job application. Can be given
|
|
414
|
+
* as command line arguments in form `--arg=value`.
|
|
416
415
|
*/
|
|
417
416
|
createJob(outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
418
417
|
/**
|
|
419
|
-
* Runs a job to convert geometry data of active version of the file
|
|
420
|
-
* {@link createJob | createJob("geometry")}.
|
|
418
|
+
* Runs a File Converter job to convert geometry data of active version of the file to the specified
|
|
419
|
+
* format. This is alias to {@link createJob | createJob("geometry")}.
|
|
421
420
|
*
|
|
422
421
|
* @param type - Geometry data type. Can be one of:
|
|
423
422
|
*
|
|
424
|
-
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` viewer.
|
|
425
|
-
* - `gltf` - `glTF` format, for opening a file in `Three.js` viewer.
|
|
423
|
+
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` 3D viewer.
|
|
424
|
+
* - `gltf` - `glTF` format, for opening a file in `Three.js` 3D viewer.
|
|
426
425
|
*
|
|
427
|
-
* @param parameters - Parameters for the
|
|
428
|
-
*
|
|
426
|
+
* @param parameters - Parameters for the File Converter tool. Can be given as command line arguments
|
|
427
|
+
* in form `--arg=value`.
|
|
429
428
|
*/
|
|
430
429
|
extractGeometry(type?: string, parameters?: string | object): Promise<Job>;
|
|
431
430
|
/**
|
|
432
|
-
* Runs a job to extract properties of the active version of the file. This is alias to
|
|
431
|
+
* Runs a File Converter job to extract properties of the active version of the file. This is alias to
|
|
433
432
|
* {@link createJob | createJob("properties")}.
|
|
434
433
|
*
|
|
435
|
-
* @param parameters - Parameters for the
|
|
436
|
-
*
|
|
434
|
+
* @param parameters - Parameters for the File Converter tool. Can be given as command line arguments
|
|
435
|
+
* in form `--arg=value`.
|
|
437
436
|
*/
|
|
438
437
|
extractProperties(parameters?: string | object): Promise<Job>;
|
|
439
438
|
/**
|
|
440
|
-
* Runs
|
|
439
|
+
* Runs an IFC validator job to validate the active version of the file. This is alias to
|
|
441
440
|
* {@link createJob | createJob("validation")}.
|
|
442
441
|
*
|
|
443
442
|
* To get validation report use {@link downloadResource | downloadResource("validation_report.json")}.
|
|
444
443
|
*
|
|
445
|
-
* @param parameters - Parameters for the
|
|
446
|
-
*
|
|
444
|
+
* @param parameters - Parameters for the IFC validator tool. Can be given as command line arguments in
|
|
445
|
+
* form `--arg=value`.
|
|
447
446
|
*/
|
|
448
447
|
validate(parameters?: string | object): Promise<Job>;
|
|
449
448
|
/**
|
|
450
449
|
* Waits for jobs of the active version of the file to be done. Job is done when it changes to `none`,
|
|
451
450
|
* `done` or `failed` status.
|
|
452
451
|
*
|
|
453
|
-
* @param jobs - Job or job
|
|
454
|
-
* `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job
|
|
452
|
+
* @param jobs - Job name or array of job names to wait on. Can be `geometry`, `geometryGltf`,
|
|
453
|
+
* `properties`, `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job
|
|
454
|
+
* name.
|
|
455
455
|
* @param waitAll - If this parameter is `true`, the function returns when all the specified jobs have
|
|
456
456
|
* done. If `false`, the function returns when any one of the jobs are done.
|
|
457
457
|
* @param params - An object containing waiting parameters.
|
package/lib/Api/Job.d.ts
CHANGED
|
@@ -64,14 +64,21 @@ export declare class Job extends Endpoint {
|
|
|
64
64
|
*/
|
|
65
65
|
get lastUpdate(): string;
|
|
66
66
|
/**
|
|
67
|
-
* Job type. Can be
|
|
68
|
-
*
|
|
67
|
+
* Job type. Can be:
|
|
68
|
+
*
|
|
69
|
+
* - `geometry` - Convert file geometry data to `VSFX` format.
|
|
70
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format.
|
|
71
|
+
* - `properties` - Extract file properties.
|
|
72
|
+
* - `validation` - Validate the IFC file.
|
|
73
|
+
* - `clash` - Create the clash detection report.
|
|
74
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
75
|
+
* - Other custom job name.
|
|
69
76
|
*
|
|
70
77
|
* @readonly
|
|
71
78
|
*/
|
|
72
79
|
get outputFormat(): string;
|
|
73
80
|
/**
|
|
74
|
-
* Parameters with which the job
|
|
81
|
+
* Parameters with which the job was started. For more information, see
|
|
75
82
|
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}.
|
|
76
83
|
*
|
|
77
84
|
* @readonly
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "26.5.
|
|
3
|
+
"version": "26.5.4",
|
|
4
4
|
"description": "JavaScript REST API client for the Open Cloud Server",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"docs": "typedoc"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@inweb/eventemitter2": "~26.5.
|
|
29
|
+
"@inweb/eventemitter2": "~26.5.4"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/Api/Assembly.ts
CHANGED
|
@@ -105,7 +105,7 @@ export class Assembly extends Endpoint {
|
|
|
105
105
|
/**
|
|
106
106
|
* Assembly geometry data type:
|
|
107
107
|
*
|
|
108
|
-
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` viewer.
|
|
108
|
+
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` 3D viewer.
|
|
109
109
|
*
|
|
110
110
|
* Returns an empty string if the geometry data is not yet ready.
|
|
111
111
|
*/
|
package/src/Api/Client.ts
CHANGED
|
@@ -605,13 +605,17 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
605
605
|
* generally retrieved from a {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList}
|
|
606
606
|
* object returned as a result of a user selecting files using the HTML `<input>` element.
|
|
607
607
|
* @param params - An object containing upload parameters.
|
|
608
|
-
* @param params.geometry -
|
|
608
|
+
* @param params.geometry - Run File Converter job to convert geometry data after uploading the file.
|
|
609
|
+
* Can be:
|
|
609
610
|
*
|
|
610
|
-
* - `true` - Convert file geometry data to `VSFX` format
|
|
611
|
-
* - `vsfx` - Convert file geometry data to `VSFX` format
|
|
612
|
-
* - `gltf` - Convert file geometry data to `glTF` format
|
|
611
|
+
* - `true` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
612
|
+
* - `vsfx` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
613
|
+
* - `gltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
613
614
|
*
|
|
614
|
-
* @param params.properties -
|
|
615
|
+
* @param params.properties - Run File Converter job to extract properties after uploading the file.
|
|
616
|
+
* @param params.jobParameters - Parameters for the File Converter tool. Use this to specify aditional
|
|
617
|
+
* parameters for retrieving the geometry and properties of uploaded file. Can be given as command
|
|
618
|
+
* line arguments in form `--arg=value`.
|
|
615
619
|
* @param params.waitForDone - Wait for geometry and properties jobs to complete.
|
|
616
620
|
* @param params.timeout - The time, in milliseconds that the function should wait jobs. If no one jobs
|
|
617
621
|
* are done during this time, the `TimeoutError` exception will be thrown.
|
|
@@ -627,6 +631,10 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
627
631
|
params: {
|
|
628
632
|
geometry?: boolean | string;
|
|
629
633
|
properties?: boolean;
|
|
634
|
+
jobParameters?: {
|
|
635
|
+
geometry?: string | object;
|
|
636
|
+
properties?: string | object;
|
|
637
|
+
};
|
|
630
638
|
waitForDone?: boolean;
|
|
631
639
|
timeout?: number;
|
|
632
640
|
interval?: number;
|
|
@@ -647,10 +655,11 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
647
655
|
.then((data) => new File(data, this.httpClient));
|
|
648
656
|
|
|
649
657
|
const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
|
|
658
|
+
const jobParameters = params.jobParameters || {};
|
|
650
659
|
|
|
651
660
|
const jobs: string[] = [];
|
|
652
|
-
if (params.geometry) jobs.push((await result.extractGeometry(geometryType)).outputFormat);
|
|
653
|
-
if (params.properties) jobs.push((await result.extractProperties()).outputFormat);
|
|
661
|
+
if (params.geometry) jobs.push((await result.extractGeometry(geometryType, jobParameters.geometry)).outputFormat);
|
|
662
|
+
if (params.properties) jobs.push((await result.extractProperties(jobParameters.properties)).outputFormat);
|
|
654
663
|
if (jobs.length > 0)
|
|
655
664
|
if (params.waitForDone) await result.waitForDone(jobs, true, params);
|
|
656
665
|
else await result.checkout();
|
|
@@ -760,18 +769,17 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
760
769
|
* Runs a new job on the server for the sepecified file.
|
|
761
770
|
*
|
|
762
771
|
* @param fileId - File ID.
|
|
763
|
-
* @param outputFormat - The job type. Can be
|
|
772
|
+
* @param outputFormat - The job type. Can be:
|
|
764
773
|
*
|
|
765
|
-
* - `geometry` - Convert file geometry data to `VSFX` format
|
|
766
|
-
* - `geometryGltf` - Convert file geometry data to `glTF` format
|
|
774
|
+
* - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
775
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
767
776
|
* - `properties` - Extract file properties.
|
|
768
|
-
* - `validation` - Validate the
|
|
769
|
-
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the
|
|
770
|
-
* - Other custom job name. Custom job
|
|
771
|
-
* creating a job.
|
|
777
|
+
* - `validation` - Validate the IFC file.
|
|
778
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
779
|
+
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
772
780
|
*
|
|
773
|
-
* @param parameters - Parameters for the job
|
|
774
|
-
*
|
|
781
|
+
* @param parameters - Parameters for the File Converter tool or custom job application. Can be given
|
|
782
|
+
* as command line arguments in form `--arg=value`.
|
|
775
783
|
*/
|
|
776
784
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job> {
|
|
777
785
|
return this.httpClient
|
|
@@ -877,6 +885,9 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
877
885
|
* @param files - List of file IDs.
|
|
878
886
|
* @param name - Assembly name.
|
|
879
887
|
* @param params - Additional assembly creating parameters.
|
|
888
|
+
* @param params.jobParameters - Parameters for the File Converter tool. Use this to specify aditional
|
|
889
|
+
* parameters for generating the geometry and properties of the new assembly. Can be given as command
|
|
890
|
+
* line arguments in form `--arg=value`.
|
|
880
891
|
* @param params.waitForDone - Wait for assembly to be created.
|
|
881
892
|
* @param params.timeout - The time, in milliseconds, that the function should wait for the assembly to
|
|
882
893
|
* be created. If the assembly is not created within this time, a TimeoutError exception will be
|
|
@@ -891,20 +902,31 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
891
902
|
createAssembly(
|
|
892
903
|
files: string[],
|
|
893
904
|
name: string,
|
|
894
|
-
params
|
|
905
|
+
params: {
|
|
906
|
+
jobParameters?: {
|
|
907
|
+
geometry?: string | object;
|
|
908
|
+
properties?: string | object;
|
|
909
|
+
};
|
|
895
910
|
waitForDone?: boolean;
|
|
896
911
|
timeout?: number;
|
|
897
912
|
interval?: number;
|
|
898
913
|
signal?: AbortSignal;
|
|
899
914
|
onCheckout?: (assembly: Assembly, ready: boolean) => boolean;
|
|
900
|
-
}
|
|
915
|
+
} = {}
|
|
901
916
|
): Promise<Assembly> {
|
|
902
|
-
const
|
|
917
|
+
const jobParameters = params.jobParameters || {};
|
|
903
918
|
return this.httpClient
|
|
904
|
-
.post("/assemblies", {
|
|
919
|
+
.post("/assemblies", {
|
|
920
|
+
name,
|
|
921
|
+
files,
|
|
922
|
+
jobParameters: {
|
|
923
|
+
geometry: parseArgs(jobParameters.geometry),
|
|
924
|
+
properties: parseArgs(jobParameters.properties),
|
|
925
|
+
},
|
|
926
|
+
})
|
|
905
927
|
.then((response) => response.json())
|
|
906
928
|
.then((data) => new Assembly(data, this.httpClient))
|
|
907
|
-
.then((result) => (waitForDone ? result.waitForDone(params) : result));
|
|
929
|
+
.then((result) => (params.waitForDone ? result.waitForDone(params) : result));
|
|
908
930
|
}
|
|
909
931
|
|
|
910
932
|
/**
|
package/src/Api/File.ts
CHANGED
|
@@ -123,7 +123,7 @@ export class File extends Endpoint {
|
|
|
123
123
|
/**
|
|
124
124
|
* Returns a list of file formats in which the active version of the file was exported.
|
|
125
125
|
*
|
|
126
|
-
* To export file to one of the supported formats
|
|
126
|
+
* To export file to one of the supported formats run the File Converter job using
|
|
127
127
|
* {@link createJob | createJob()}. To download exported file use
|
|
128
128
|
* {@link downloadResource | downloadResource()}.
|
|
129
129
|
*
|
|
@@ -138,8 +138,8 @@ export class File extends Endpoint {
|
|
|
138
138
|
/**
|
|
139
139
|
* Geometry data type of the active file version. Can be one of:
|
|
140
140
|
*
|
|
141
|
-
* - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` viewer.
|
|
142
|
-
* - `gltf` - `glTF` format, file can be opened in `Three.js` viewer.
|
|
141
|
+
* - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` 3D viewer.
|
|
142
|
+
* - `gltf` - `glTF` format, file can be opened in `Three.js` 3D viewer.
|
|
143
143
|
*
|
|
144
144
|
* Returns an empty string if geometry data has not yet been converted. A files without geometry data
|
|
145
145
|
* can be exported to other formas, but cannot be opened in viewer.
|
|
@@ -541,15 +541,15 @@ export class File extends Endpoint {
|
|
|
541
541
|
* Downloads a resource file of the active version of the file. Resource files are files that contain
|
|
542
542
|
* model scene descriptions, or geometry data, or exported files.
|
|
543
543
|
*
|
|
544
|
-
* @example Export file to
|
|
544
|
+
* @example Export file to PDF.
|
|
545
545
|
*
|
|
546
546
|
* ```javascript
|
|
547
|
-
* const job = await file.
|
|
547
|
+
* const job = await file.createJob("pdf");
|
|
548
548
|
* await job.waitForDone();
|
|
549
|
-
* const
|
|
550
|
-
* const arrayBuffer = await file.downloadResource(
|
|
549
|
+
* const pdfResourceName = file.exports.find((x) => x.endsWith(".pdf"));
|
|
550
|
+
* const arrayBuffer = await file.downloadResource(pdfResourceName);
|
|
551
551
|
* const blob = new Blob([arrayBuffer]);
|
|
552
|
-
* const fileName = file.name + ".
|
|
552
|
+
* const fileName = file.name + ".pdf";
|
|
553
553
|
* FileSaver.saveAs(blob, fileName);
|
|
554
554
|
* ```
|
|
555
555
|
*
|
|
@@ -658,20 +658,19 @@ export class File extends Endpoint {
|
|
|
658
658
|
/**
|
|
659
659
|
* Runs a new job on the server for the active version of the file.
|
|
660
660
|
*
|
|
661
|
-
* @param outputFormat - The job type. Can be
|
|
661
|
+
* @param outputFormat - The job type. Can be:
|
|
662
662
|
*
|
|
663
|
-
* - `geometry` - Convert file geometry data to `VSFX` format
|
|
664
|
-
* - `geometryGltf` - Convert file geometry data to `glTF` format
|
|
663
|
+
* - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
664
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
665
665
|
* - `properties` - Extract file properties.
|
|
666
|
-
* - `validation` - Validate the
|
|
667
|
-
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the
|
|
668
|
-
*
|
|
666
|
+
* - `validation` - Validate the IFC file.
|
|
667
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format. Use
|
|
668
|
+
* {@link exports} to get the list of completed file exports. Use
|
|
669
669
|
* {@link downloadResource | downloadResource()} to download the exported file.
|
|
670
|
-
* - Other custom job name. Custom job
|
|
671
|
-
* job.
|
|
670
|
+
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
672
671
|
*
|
|
673
|
-
* @param parameters - Parameters for the job
|
|
674
|
-
*
|
|
672
|
+
* @param parameters - Parameters for the File Converter tool or custom job application. Can be given
|
|
673
|
+
* as command line arguments in form `--arg=value`.
|
|
675
674
|
*/
|
|
676
675
|
createJob(outputFormat: string, parameters?: string | object): Promise<Job> {
|
|
677
676
|
const jobs = new Endpoint("/jobs", this.httpClient, this.headers);
|
|
@@ -686,40 +685,40 @@ export class File extends Endpoint {
|
|
|
686
685
|
}
|
|
687
686
|
|
|
688
687
|
/**
|
|
689
|
-
* Runs a job to convert geometry data of active version of the file
|
|
690
|
-
* {@link createJob | createJob("geometry")}.
|
|
688
|
+
* Runs a File Converter job to convert geometry data of active version of the file to the specified
|
|
689
|
+
* format. This is alias to {@link createJob | createJob("geometry")}.
|
|
691
690
|
*
|
|
692
691
|
* @param type - Geometry data type. Can be one of:
|
|
693
692
|
*
|
|
694
|
-
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` viewer.
|
|
695
|
-
* - `gltf` - `glTF` format, for opening a file in `Three.js` viewer.
|
|
693
|
+
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` 3D viewer.
|
|
694
|
+
* - `gltf` - `glTF` format, for opening a file in `Three.js` 3D viewer.
|
|
696
695
|
*
|
|
697
|
-
* @param parameters - Parameters for the
|
|
698
|
-
*
|
|
696
|
+
* @param parameters - Parameters for the File Converter tool. Can be given as command line arguments
|
|
697
|
+
* in form `--arg=value`.
|
|
699
698
|
*/
|
|
700
699
|
extractGeometry(type?: string, parameters?: string | object): Promise<Job> {
|
|
701
700
|
return this.createJob(type === "gltf" ? "geometryGltf" : "geometry", parameters);
|
|
702
701
|
}
|
|
703
702
|
|
|
704
703
|
/**
|
|
705
|
-
* Runs a job to extract properties of the active version of the file. This is alias to
|
|
704
|
+
* Runs a File Converter job to extract properties of the active version of the file. This is alias to
|
|
706
705
|
* {@link createJob | createJob("properties")}.
|
|
707
706
|
*
|
|
708
|
-
* @param parameters - Parameters for the
|
|
709
|
-
*
|
|
707
|
+
* @param parameters - Parameters for the File Converter tool. Can be given as command line arguments
|
|
708
|
+
* in form `--arg=value`.
|
|
710
709
|
*/
|
|
711
710
|
extractProperties(parameters?: string | object): Promise<Job> {
|
|
712
711
|
return this.createJob("properties", parameters);
|
|
713
712
|
}
|
|
714
713
|
|
|
715
714
|
/**
|
|
716
|
-
* Runs
|
|
715
|
+
* Runs an IFC validator job to validate the active version of the file. This is alias to
|
|
717
716
|
* {@link createJob | createJob("validation")}.
|
|
718
717
|
*
|
|
719
718
|
* To get validation report use {@link downloadResource | downloadResource("validation_report.json")}.
|
|
720
719
|
*
|
|
721
|
-
* @param parameters - Parameters for the
|
|
722
|
-
*
|
|
720
|
+
* @param parameters - Parameters for the IFC validator tool. Can be given as command line arguments in
|
|
721
|
+
* form `--arg=value`.
|
|
723
722
|
*/
|
|
724
723
|
validate(parameters?: string | object): Promise<Job> {
|
|
725
724
|
return this.createJob("validation", parameters);
|
|
@@ -729,8 +728,9 @@ export class File extends Endpoint {
|
|
|
729
728
|
* Waits for jobs of the active version of the file to be done. Job is done when it changes to `none`,
|
|
730
729
|
* `done` or `failed` status.
|
|
731
730
|
*
|
|
732
|
-
* @param jobs - Job or job
|
|
733
|
-
* `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job
|
|
731
|
+
* @param jobs - Job name or array of job names to wait on. Can be `geometry`, `geometryGltf`,
|
|
732
|
+
* `properties`, `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job
|
|
733
|
+
* name.
|
|
734
734
|
* @param waitAll - If this parameter is `true`, the function returns when all the specified jobs have
|
|
735
735
|
* done. If `false`, the function returns when any one of the jobs are done.
|
|
736
736
|
* @param params - An object containing waiting parameters.
|
package/src/Api/Job.ts
CHANGED
|
@@ -121,8 +121,15 @@ export class Job extends Endpoint {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
* Job type. Can be
|
|
125
|
-
*
|
|
124
|
+
* Job type. Can be:
|
|
125
|
+
*
|
|
126
|
+
* - `geometry` - Convert file geometry data to `VSFX` format.
|
|
127
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format.
|
|
128
|
+
* - `properties` - Extract file properties.
|
|
129
|
+
* - `validation` - Validate the IFC file.
|
|
130
|
+
* - `clash` - Create the clash detection report.
|
|
131
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
132
|
+
* - Other custom job name.
|
|
126
133
|
*
|
|
127
134
|
* @readonly
|
|
128
135
|
*/
|
|
@@ -131,7 +138,7 @@ export class Job extends Endpoint {
|
|
|
131
138
|
}
|
|
132
139
|
|
|
133
140
|
/**
|
|
134
|
-
* Parameters with which the job
|
|
141
|
+
* Parameters with which the job was started. For more information, see
|
|
135
142
|
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}.
|
|
136
143
|
*
|
|
137
144
|
* @readonly
|