@buerli.io/headless 0.2.0 → 0.3.0-beta.0

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.
@@ -1,4 +1,4 @@
1
- import { FlipType, ReorientedType } from '@buerli.io/classcad';
1
+ import { BooleanOperationType, ChamferType, FlipType, ReorientedType, WorkAxisType, WorkCoordSystemType, WorkPlaneType, WorkPointType, ViewType, OrientationType, ExtrusionType, BrepElemType } from '@buerli.io/classcad';
2
2
  import { ObjectID, PointMemValue } from '@buerli.io/core';
3
3
  import { BufferGeometry, Scene } from 'three';
4
4
  /**
@@ -60,8 +60,8 @@ export declare type ApiHistory = {
60
60
  * @image // tbd
61
61
  */
62
62
  addNodes: (...nodes: {
63
- productId: number;
64
- ownerId: number;
63
+ productId: VID;
64
+ ownerId: VID;
65
65
  transformation: Transform;
66
66
  name?: string;
67
67
  }[]) => IDs;
@@ -135,9 +135,9 @@ export declare type ApiHistory = {
135
135
  * @return array of ids of the added dimensions
136
136
  */
137
137
  addDimensions: (...dimensions: {
138
- productId: number;
138
+ productId: VID;
139
139
  dimParam: {
140
- dimType: DimTypes;
140
+ dimType: 'LinearDimension';
141
141
  dimName?: string;
142
142
  dimLabel: string;
143
143
  dimValue?: number | null;
@@ -145,11 +145,11 @@ export declare type ApiHistory = {
145
145
  dimEndPos: PointMemValue;
146
146
  dimTextPos: PointMemValue;
147
147
  dimTextAngle: number;
148
- dimOrientation: OrientationTypes;
148
+ dimOrientation: OrientationType;
149
149
  dimColor?: number;
150
150
  dimLayer?: string;
151
151
  };
152
- dxfView: ViewTypes;
152
+ dxfView: ViewType;
153
153
  }[]) => IDs;
154
154
  /**
155
155
  * Creates different 2D views, depending on the given view types, in the given product.
@@ -163,7 +163,7 @@ export declare type ApiHistory = {
163
163
  * await api.create2DViews(productId, ['Top', 'Right_90°', 'Iso'])
164
164
  * @image // tbd
165
165
  */
166
- create2DViews: (productId: VID, viewTypes: ViewTypes[]) => IDs;
166
+ create2DViews: (productId: VID, viewTypes: ViewType[]) => IDs;
167
167
  /**
168
168
  * This method returns the boundary box of the given views.
169
169
  * @param productId id of the product from where the boundary box will returned
@@ -176,8 +176,9 @@ export declare type ApiHistory = {
176
176
  * console.info(bbs) // [[{x: -105, y: -89, z: 0}, {x: 105, y: 55, z: 0}], [...], [...]]
177
177
  * @image // tbd
178
178
  */
179
- getBoundaryBoxFromViews: (productId: VID, viewTypes?: ViewTypes[]) => Promise<[PointMemValue, PointMemValue][]>;
179
+ getBoundaryBoxFromViews: (productId: VID, viewTypes?: ViewType[]) => Promise<[PointMemValue, PointMemValue][]>;
180
180
  /**
181
+ * Place the 2D views relatively to the origin.
181
182
  * @param productId id of the product where the views will be placed in
182
183
  * @param viewPositions array of objects, containing the viewType and a vector which defines the moving vector of the given view
183
184
  * @example
@@ -189,10 +190,11 @@ export declare type ApiHistory = {
189
190
  * @image // tbd
190
191
  */
191
192
  place2DViews: (productId: VID, viewPositions: {
192
- viewType: ViewTypes;
193
+ viewType: ViewType;
193
194
  vector: PointMemValue;
194
195
  }[]) => Promise<void>;
195
196
  /**
197
+ * Export the placed views as dxf file.
196
198
  * @param productId id of the product where the views exist for export
197
199
  * @example
198
200
  * // After creating and placing the views, see place2DViews(), you can export them
@@ -202,13 +204,79 @@ export declare type ApiHistory = {
202
204
  */
203
205
  exportDXF: (productId: VID) => Promise<Uint8Array | null>;
204
206
  /**
207
+ * Export the placed views as svg file.
208
+ * @param productId id of the product where the views exist for export
209
+ * @example
210
+ * // After creating and placing the views, see place2DViews(), you can export them
211
+ * // You will get the svg stream back
212
+ * await api.exportSVG(productId)
213
+ * @image // tbd
214
+ */
215
+ exportSVG: (productId: VID) => Promise<Uint8Array | null>;
216
+ /**
217
+ * Remove existing dimensions from the view.
205
218
  * @param dimensionsIds ids of the dimensions to be removed
206
219
  * @example
207
220
  * // You can remove existing dimensions
208
221
  * await api.removeDimensions(dimensionIds)
209
222
  * @image // tbd
210
223
  */
211
- removeDimensions: (dimensionIds: number[]) => Promise<void>;
224
+ removeDimensions: (dimensionIds: VID[]) => Promise<void>;
225
+ /**
226
+ * Creates a linear pattern
227
+ * @param partId Id of the part to create the linear pattern in.
228
+ * @param entities included entities of linear operation.
229
+ * @param references1 references for the first axis of the pattern. E.g. edge / work axis or 2 vertices / work points
230
+ * @param params1 parameter object which includes inverted flag, distance, count and merged flag
231
+ * for the first direction of the pattern.
232
+ * @param references2 optional references for the second axis of the pattern.
233
+ * @param params2 optional parameter object for second direction of pattern.
234
+ */
235
+ linearPattern: (partId: VID, entities: VID[], references1: VID[], params1: {
236
+ inverted: 0 | 1;
237
+ distance: number | string;
238
+ count: number | string;
239
+ merged: 0 | 1;
240
+ }, references2?: VID[], params2?: {
241
+ inverted: 0 | 1;
242
+ distance: number | string;
243
+ count: number | string;
244
+ }) => ID;
245
+ /**
246
+ * Creates a circular pattern
247
+ * @param partId Id of the part to create the circular pattern in.
248
+ * @param entities included entities of circular operation.
249
+ * @param references references for the rotation axis of the pattern. E.g. edge / work axis or 2 vertices / work points
250
+ * @param params parameter object which includes inverted flag, angle, count and merged flag.
251
+ */
252
+ circularPattern: (partId: VID, entities: VID[], references: VID[], params: {
253
+ inverted: 0 | 1;
254
+ angle: number | string;
255
+ count: number | string;
256
+ merged: 0 | 1;
257
+ }) => ID;
258
+ /**
259
+ * Creates an extrusion
260
+ * @param partId Id of the part to create the extrusion in.
261
+ * @param sketchId Id of the sketch to extrude
262
+ * @param type Type of extrusion (up, down, symmetric, custom)
263
+ * @param limit1 Start of extrusion (0 = start at sketch, only for type custom necessary)
264
+ * @param limit2 End of extrusion, which is actually the height
265
+ * @param taperAngle Angle of taper for extrusion
266
+ * @param direction Direction of extrusion
267
+ * @param capEnds If true, ends will be capped, else a sheet will be created
268
+ */
269
+ extrusion: (partId: VID, sketchId: VID, type: ExtrusionType, limit1: number | string, limit2: number | string, taperAngle: number | string, direction: PointMemValue, capEnds: 0 | 1) => ID;
270
+ /**
271
+ * Creates a revolve
272
+ * @param partId Id of the part to create the revolve in.
273
+ * @param sketchId Id of the sketch to revolve
274
+ * @param axisIds Array of ids, either [lineId] or [point1Id, point2Id], ids can be both ccId or graphicId
275
+ * @param angle1 Start of revolve in degrees
276
+ * @param angle2 End of revolve in degrees
277
+ * @param inverted flag, whether to invert the axis or not
278
+ */
279
+ revolve: (partId: VID, sketchId: VID, axisIds: VID[], angle1: number | string, angle2: number | string, inverted: 0 | 1) => ID;
212
280
  /**
213
281
  * Creates a boolean operation.
214
282
  * @param partId id of the part where the operation will be created on
@@ -219,12 +287,12 @@ export declare type ApiHistory = {
219
287
  * const part = api.createPart('Part')
220
288
  * const cyl = api.cylinder(part, [], 10, 100)
221
289
  * const box = api.box(part, [], 20, 20, 20)
222
- * api.boolean(part, 'Subtraction', [box, cyl])
290
+ * api.boolean(part, BooleanOperationType.Subtraction, [box, cyl])
223
291
  * const geoms = await api.createBufferGeometry(part)
224
292
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
225
293
  * @image /doc/assets/history/boolean.jpg
226
294
  */
227
- boolean: (partId: VID, type: BooleanTypes, entities: VID[]) => ID;
295
+ boolean: (partId: VID, type: BooleanOperationType, entities: VID[]) => ID;
228
296
  /**
229
297
  * Creates a simple box entity
230
298
  * @param partId id of the part where the box will be created
@@ -240,7 +308,7 @@ export declare type ApiHistory = {
240
308
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
241
309
  * @image /doc/assets/history/box.jpg
242
310
  */
243
- box: (partId: VID, references: number[], width: number | string, length: number | string, height: number | string) => ID;
311
+ box: (partId: VID, references: VID[], width: number | string, length: number | string, height: number | string) => ID;
244
312
  /**
245
313
  * Creates a simple cylinder entity
246
314
  * @param partId id of the part where the cylinder will be created
@@ -255,7 +323,7 @@ export declare type ApiHistory = {
255
323
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
256
324
  * @image /doc/assets/history/cylinder.jpg
257
325
  */
258
- cylinder: (partId: VID, references: number[], diameter: number | string, height: number | string) => ID;
326
+ cylinder: (partId: VID, references: VID[], diameter: number | string, height: number | string) => ID;
259
327
  /**
260
328
  * Creates a chamfer at the given edge references.
261
329
  * @param partId id of the part where the chamfers will be created
@@ -269,12 +337,12 @@ export declare type ApiHistory = {
269
337
  * const part = api.createPart('Part')
270
338
  * api.cylinder(part, [], 10, 100)
271
339
  * const bottomEdges = await api.pick(part, 'edge', [{ x: 0, y: 0, z: 0 }])
272
- * api.chamfer(part, 'Equal_Distance', bottomEdges, 2, 0, 0)
340
+ * api.chamfer(part, ChamferType.Equal_Distance, bottomEdges, 2, 0, 0)
273
341
  * const geoms = await api.createBufferGeometry(part)
274
342
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
275
343
  * @image // tbd
276
344
  */
277
- chamfer: (partId: VID, type: ChamferTypes, references: VID[], dist1: number, dist2: number, angle: number) => ID;
345
+ chamfer: (partId: VID, type: ChamferType, references: VIDs, dist1: number | string, dist2: number | string, angle: number | string) => ID;
278
346
  /**
279
347
  * Creates a simple cone entity.
280
348
  * @param partId id of the part where the cone will be created
@@ -290,7 +358,7 @@ export declare type ApiHistory = {
290
358
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
291
359
  * @image /doc/assets/history/cone.jpg
292
360
  */
293
- cone: (partId: VID, references: number[], bDiameter: number, tDiameter: number, height: number) => ID;
361
+ cone: (partId: VID, references: VID[], bDiameter: number | string, tDiameter: number | string, height: number | string) => ID;
294
362
  /**
295
363
  * Creates a fastened constraint between two mates of an assembly.
296
364
  * @param asmId id of the assembly to create constraints on
@@ -335,16 +403,16 @@ export declare type ApiHistory = {
335
403
  * @image /doc/assets/history/fastenedConstraint.jpg
336
404
  */
337
405
  createFastenedConstraint: (asmId: VID, mate1: {
338
- matePath: number[];
339
- wcsId: number;
406
+ matePath: VID[];
407
+ wcsId: VID;
340
408
  flip: FlipType;
341
409
  reoriented: ReorientedType;
342
410
  }, mate2: {
343
- matePath: number[];
344
- wcsId: number;
411
+ matePath: VID[];
412
+ wcsId: VID;
345
413
  flip: FlipType;
346
414
  reoriented: ReorientedType;
347
- }, xOffset: number, yOffset: number, zOffset: number, name: string) => ID;
415
+ }, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => ID;
348
416
  /**
349
417
  * Updates a fastened constraint.
350
418
  * @param constrId id of the constraint to update
@@ -357,16 +425,16 @@ export declare type ApiHistory = {
357
425
  * @image // tbd
358
426
  */
359
427
  updateFastenedConstraint: (constrId: VID, mate1: {
360
- matePath: number[];
361
- wcsId: number;
428
+ matePath: VID[];
429
+ wcsId: VID;
362
430
  flip: FlipType;
363
431
  reoriented: ReorientedType;
364
432
  }, mate2: {
365
- matePath: number[];
366
- wcsId: number;
433
+ matePath: VID[];
434
+ wcsId: VID;
367
435
  flip: FlipType;
368
436
  reoriented: ReorientedType;
369
- }, xOffset: number, yOffset: number, zOffset: number) => Promise<void>;
437
+ }, xOffset: number | string, yOffset: number | string, zOffset: number | string) => Promise<void>;
370
438
  /**
371
439
  * Updates multiple fastened constraints
372
440
  * @param constraints array of constraint parameter objects
@@ -374,22 +442,22 @@ export declare type ApiHistory = {
374
442
  * @image // tbd
375
443
  */
376
444
  updateFastenedConstraints: (...constraints: {
377
- constrId: number;
445
+ constrId: VID;
378
446
  mate1: {
379
447
  matePath: number[];
380
- wcsId: number;
448
+ wcsId: VID;
381
449
  flip: number;
382
450
  reoriented: number;
383
451
  };
384
452
  mate2: {
385
453
  matePath: number[];
386
- wcsId: number;
454
+ wcsId: VID;
387
455
  flip: number;
388
456
  reoriented: number;
389
457
  };
390
- xOffset: number;
391
- yOffset: number;
392
- zOffset: number;
458
+ xOffset: number | string;
459
+ yOffset: number | string;
460
+ zOffset: number | string;
393
461
  }[]) => Promise<void>;
394
462
  /**
395
463
  * Creates a fastened origin constraint for mate1 to the origin (0, 0, 0).
@@ -428,11 +496,11 @@ export declare type ApiHistory = {
428
496
  * @image /doc/assets/history/fastenedOriginConstraint.jpg
429
497
  */
430
498
  createFastenedOriginConstraint: (asmId: VID, mate1: {
431
- matePath: number[];
432
- wcsId: number;
499
+ matePath: VID[];
500
+ wcsId: VID;
433
501
  flip: FlipType;
434
502
  reoriented: ReorientedType;
435
- }, xOffset: number, yOffset: number, zOffset: number, name: string) => ID;
503
+ }, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => ID;
436
504
  /**
437
505
  * Updates a fastened origin constraint.
438
506
  * @param constrId id of the constraint to update
@@ -444,11 +512,11 @@ export declare type ApiHistory = {
444
512
  * @image // tbd
445
513
  */
446
514
  updateFastenedOriginConstraint: (constrId: VID, mate1: {
447
- matePath: number[];
448
- wcsId: number;
515
+ matePath: VID[];
516
+ wcsId: VID;
449
517
  flip: FlipType;
450
518
  reoriented: ReorientedType;
451
- }, xOffset: number, yOffset: number, zOffset: number) => Promise<void>;
519
+ }, xOffset: number | string, yOffset: number | string, zOffset: number | string) => Promise<void>;
452
520
  /**
453
521
  * Updates multiple fastened origin constraints
454
522
  * @param constraints array of constraint parameter objects
@@ -463,9 +531,9 @@ export declare type ApiHistory = {
463
531
  flip: number;
464
532
  reoriented: number;
465
533
  };
466
- xOffset: number;
467
- yOffset: number;
468
- zOffset: number;
534
+ xOffset: number | string;
535
+ yOffset: number | string;
536
+ zOffset: number | string;
469
537
  }[]) => Promise<void>;
470
538
  /**
471
539
  * Creates the buffer geometry of the product (part or assembly).
@@ -507,7 +575,7 @@ export declare type ApiHistory = {
507
575
  createExpressions: (partId: VID, ...members: {
508
576
  name: string;
509
577
  value: number | PointMemValue | string;
510
- }[]) => Promise<void>;
578
+ }[]) => Promise<boolean>;
511
579
  /**
512
580
  * Creates a new assembly template. This template can be used multiple times as a sub assembly in the root assembly.
513
581
  * @param name [optional] name of the assembly template. Default = 'Assembly'
@@ -548,7 +616,7 @@ export declare type ApiHistory = {
548
616
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
549
617
  * @image /doc/assets/history/assemblyTemplate.jpg
550
618
  */
551
- createAssemblyAsTemplate: (name?: string) => Promise<number | null>;
619
+ createAssemblyAsTemplate: (name?: string) => ID;
552
620
  /**
553
621
  * Creates a new rootAssembly. This is the top level assembly.
554
622
  * @param name [optional] name of the root assembly. Default = 'AssemblyRoot'
@@ -574,7 +642,7 @@ export declare type ApiHistory = {
574
642
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
575
643
  * @image // tbd
576
644
  */
577
- createRootAssembly: (name?: string) => Promise<number | null>;
645
+ createRootAssembly: (name?: string) => ID;
578
646
  /**
579
647
  * Creates a new part.
580
648
  * @param name [optional] name of the part. Default = 'Part'
@@ -586,7 +654,7 @@ export declare type ApiHistory = {
586
654
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
587
655
  * @image // tbd
588
656
  */
589
- createPart: (name?: string) => Promise<number | null>;
657
+ createPart: (name?: string) => ID;
590
658
  /**
591
659
  * Creates a new part template. This template can be used multiple times to build assemblies.
592
660
  * @param name [optional] name of the part. Default = 'Part'
@@ -612,7 +680,7 @@ export declare type ApiHistory = {
612
680
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
613
681
  * @image // tbd
614
682
  */
615
- createPartAsTemplate: (name?: string) => Promise<number | null>;
683
+ createPartAsTemplate: (name?: string) => ID;
616
684
  /**
617
685
  * Creates a new work axis for the given part
618
686
  * @param partId id of the part to add the new work axis to
@@ -625,7 +693,7 @@ export declare type ApiHistory = {
625
693
  * @example //tbd
626
694
  * @image // tbd
627
695
  */
628
- createWorkAxis: (partId: VID, type: WATypes, references: VID[], position: PointMemValue, direction: PointMemValue, local: boolean, name?: string) => ID;
696
+ createWorkAxis: (partId: VID, type: WorkAxisType, references: VID[], position: PointMemValue, direction: PointMemValue, local: boolean, name?: string) => ID;
629
697
  /**
630
698
  * Creates a new work coordinate system for the given part.
631
699
  * @param partId id of the part to add the new work coord system to
@@ -651,13 +719,13 @@ export declare type ApiHistory = {
651
719
  *
652
720
  * // Creates a part template and adds geometry to it
653
721
  * const partTempl1 = await api.createPartAsTemplate('Part_Template1')
654
- * const wcs1 = await api.createWorkCoordSystem(partTempl1, 'Custom', [], offset1, rot, 0, false, 'wcs1')
655
- * const wcs3 = await api.createWorkCoordSystem(partTempl1, 'Custom', [], offset3, rot, 0, false, 'wcs3')
722
+ * const wcs1 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset1, rot, 0, false, 'wcs1')
723
+ * const wcs3 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset3, rot, 0, false, 'wcs3')
656
724
  * api.box(partTempl1, [wcs1], 30, 30, 30)
657
725
  *
658
726
  * // Creates another part template and adds geometry to it
659
727
  * const partTempl2 = await api.createPartAsTemplate('Part_Template2')
660
- * const wcs2 = await api.createWorkCoordSystem(partTempl2, 'Custom', [], offset2, rot, 0, false, 'wcs2')
728
+ * const wcs2 = await api.createWorkCoordSystem(partTempl2, WorkCoordSystemType.WCS_Custom, [], offset2, rot, 0, false, 'wcs2')
661
729
  * api.cone(partTempl2, [wcs2], 30, 0.1, 30)
662
730
  *
663
731
  * // Adds the created part templates as nodes to the root assembly
@@ -670,7 +738,7 @@ export declare type ApiHistory = {
670
738
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
671
739
  * @image // tbd
672
740
  */
673
- createWorkCoordSystem: (partId: VID, type: WCSTypes, references: VID[], coordinateSystem: PointMemValue[], offset: PointMemValue, rotation: PointMemValue, inverted: 0 | 1, local: boolean, name?: string) => ID;
741
+ createWorkCoordSystem: (partId: VID, type: WorkCoordSystemType, references: VID[], coordinateSystem: PointMemValue[], offset: PointMemValue, rotation: PointMemValue, inverted: 0 | 1, local: boolean, name?: string) => ID;
674
742
  /**
675
743
  * Creates a new work plane for the given part
676
744
  * @param partId id of the part to add the new work plane to
@@ -685,7 +753,7 @@ export declare type ApiHistory = {
685
753
  * @example // tbd
686
754
  * @image // tbd
687
755
  */
688
- createWorkPlane: (partId: VID, type: WPTypes, references: VID[], offset: number, angle: number, position: PointMemValue, normal: PointMemValue, local: boolean, name?: string) => ID;
756
+ createWorkPlane: (partId: VID, type: WorkPlaneType, references: VID[], offset: number, angle: number, position: PointMemValue, normal: PointMemValue, local: boolean, name?: string) => ID;
689
757
  /**
690
758
  * Creates a new work point for the given part
691
759
  * @param partId id of the part to add the new work point to
@@ -698,7 +766,7 @@ export declare type ApiHistory = {
698
766
  * @example // tbd
699
767
  * @image // tbd
700
768
  */
701
- createWorkPoint: (partId: VID, type: WPTypes, references: VID[], position: PointMemValue, local: boolean, name?: string) => ID;
769
+ createWorkPoint: (partId: VID, type: WorkPointType, references: VID[], position: PointMemValue, local: boolean, name?: string) => ID;
702
770
  /**
703
771
  * Deletes an existing expression.
704
772
  * @param partId id of part to delete expressions from
@@ -713,7 +781,53 @@ export declare type ApiHistory = {
713
781
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
714
782
  * @image // tbd
715
783
  */
716
- deleteExpressions: (partId: VID, members: string[]) => void;
784
+ deleteExpressions: (partId: VID, members: string[]) => Promise<boolean>;
785
+ /**
786
+ * Loads a sketch from a of1 filestream and adds its elements to a new sketch.
787
+ * The id of this new created sketch will be returned.
788
+ *
789
+ * @param partId id of the part we want to create the new sketch and copy the sketch elements into it
790
+ * @param strm stream of of1 file which contains the sketch
791
+ * @param planeId id of the face or workplane to set the new sketch on
792
+ * @param name optional name of the sketch to load from filestream
793
+ */
794
+ loadSketch: (partId: VID, strm: ArrayBuffer, planeId: VID, name?: string) => ID;
795
+ /**
796
+ * Copy an existing sketch and adds its elements to a new sketch.
797
+ * The id of this new created sketch will be returned.
798
+ *
799
+ * @param partId id of the part we want to create the new sketch and copy the sketch elements into it
800
+ * @param sketchId id of the sketch to copy
801
+ * @param planeId id of the face or workplane to set the new sketch on
802
+ */
803
+ copySketch: (partId: VID, sketchId: VID, planeId: VID) => ID;
804
+ /**
805
+ * Place/position the sketch with plane, axis and origin references.
806
+ *
807
+ * @param sketchId id of the sketch to place
808
+ * @param planeId - id of a face or a workplane. This will be the plane where the sketch lies on.
809
+ * If a plane reference already exists, planeId is optional
810
+ * @param invertPlane - if true, the normal of the plane will be inverted
811
+ * @param axisId - optional id of an edge or workaxis. This will be the x-Axis
812
+ * @param isXAxis - if true, the axisId will be the x-axis of the sketch, else the x-Axis will be the crossvector of the normal and the axisId
813
+ * @param invertAxis - if true, the direction of the axis will be inverted
814
+ * @param originId - optional point or vertex of the sketch's origin reference
815
+ */
816
+ placeSketch: (sketchId: VID, planeId: VID, invertPlane: boolean, axisId: VID, isXAxis: boolean, invertAxis: boolean, originId: VID) => Promise<void>;
817
+ /**
818
+ * Creates a simple sphere entity.
819
+ * @param partId id of the part where the cone will be created
820
+ * @param references reference of work coordinate system to place the cone at
821
+ * @param radius bottom diameter of the cone
822
+ * @example
823
+ * // Creates a sphere with radius = 20
824
+ * const part = api.createPart('Part')
825
+ * api.sphere(part, [], 20)
826
+ * const geoms = await api.createBufferGeometry(part)
827
+ * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
828
+ * @image // tbd
829
+ */
830
+ sphere: (partId: VID, references: VID[], radius: number | string) => ID;
717
831
  /**
718
832
  * Creates a fillet at the given edge references.
719
833
  * @param partId id of the part where the fillet will be created
@@ -729,7 +843,17 @@ export declare type ApiHistory = {
729
843
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
730
844
  * @image // tbd
731
845
  */
732
- fillet: (partId: VID, references: VID[], radius: number | string) => void;
846
+ fillet: (partId: VID, references: VIDs, radius: number | string) => ID;
847
+ /**
848
+ * Find geometry (vertices, edges, faces, loops) by given positions or selection. If positions parameter is null,
849
+ * user can select geometry in graphical interface. For all selected geometries this function logs its
850
+ * relevant points into console, to find the geometry later by points
851
+ * @param partId id of the part looking for geometry in or selecting them
852
+ * @param type type of geometry to find or select
853
+ * @param length number of selections to make before resolving the selection
854
+ * @param positions array of point arrays where to look for geometry or null if the geometry wants to be selected
855
+ */
856
+ findOrSelect: (partId: VID, type: BrepElemType, length: number, positions: PointMemValue[][] | null) => IDs;
733
857
  /**
734
858
  * Returns the assembly with given name from assembly container.
735
859
  * If asmName is empty, all assemblies from assembly container will be returned.
@@ -760,7 +884,7 @@ export declare type ApiHistory = {
760
884
  * @example // tbd
761
885
  * @image // tbd
762
886
  */
763
- setCurrentNode: (refId: VID) => void;
887
+ setCurrentNode: (refId: VID) => Promise<void>;
764
888
  /**
765
889
  * Sets the product with productId to the new current product
766
890
  *
@@ -768,7 +892,7 @@ export declare type ApiHistory = {
768
892
  * @example // tbd
769
893
  * @image // tbd
770
894
  */
771
- setCurrentProduct: (productId: VID) => void;
895
+ setCurrentProduct: (productId: VID) => Promise<void>;
772
896
  /**
773
897
  * Returns the id of the current node
774
898
  * @example // tbd
@@ -889,7 +1013,7 @@ export declare type ApiHistory = {
889
1013
  * @example // tbd
890
1014
  * @image // tbd
891
1015
  */
892
- removeNode: (referenceId: ObjectID, ownerId: ObjectID) => Promise<void>;
1016
+ removeNode: (referenceId: VID, ownerId: VID) => Promise<void>;
893
1017
  /**
894
1018
  * Removes multiple nodes from an assembly node at once
895
1019
  * @param nodes array of node parameter objects. See also removeNode().
@@ -897,11 +1021,11 @@ export declare type ApiHistory = {
897
1021
  * @image // tbd
898
1022
  */
899
1023
  removeNodes: (...nodes: {
900
- referenceId: number;
901
- ownerId: number;
1024
+ referenceId: VID;
1025
+ ownerId: VID;
902
1026
  }[]) => Promise<void>;
903
1027
  /**
904
- * Transforms the node with referenceId with the given transformation
1028
+ * Transforms the node with referenceId with the given transformation within an assembly
905
1029
  *
906
1030
  * @param referenceId id of the node to transform
907
1031
  * @param ownerId id of the owner (parent) of node we want to transform
@@ -945,7 +1069,7 @@ export declare type ApiHistory = {
945
1069
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
946
1070
  * @image // tbd
947
1071
  */
948
- pick: (partId: VID, type: PickTypes, points: PointMemValue[]) => IDs;
1072
+ pick: (partId: VID, type: 'vertex' | 'edge' | 'face', points: PointMemValue[]) => IDs;
949
1073
  /**
950
1074
  * Updates an existing expression
951
1075
  * @param partId id of part to update expression
@@ -990,6 +1114,7 @@ export default class CAD {
990
1114
  destroy(): void;
991
1115
  }
992
1116
  declare type VID = ObjectID | Promise<ObjectID> | null | Promise<number | null>;
1117
+ declare type VIDs = ObjectID[] | Promise<ObjectID[]>;
993
1118
  declare type ID = Promise<ObjectID> | Promise<number | null>;
994
1119
  declare type IDs = Promise<ObjectID[]>;
995
1120
  declare type Point = {
@@ -998,21 +1123,12 @@ declare type Point = {
998
1123
  z: number;
999
1124
  };
1000
1125
  export declare type Transform = [Point, Point, Point];
1001
- declare type BooleanTypes = 'Union' | 'Subtraction' | 'Intersection';
1002
- declare type WCSTypes = 'XYAxisOrigin' | 'Custom';
1003
- declare type WATypes = 'Custom' | 'WorkPoints' | 'PointAndDirection' | 'SketchLine' | 'Curve' | '2Points' | '2Planes';
1004
- declare type WPTypes = 'Custom' | 'Plane' | 'EdgeAndPoint' | '3Points' | 'PointAndNormal' | 'PointAndFace' | 'LinePlaneAndAngle';
1005
- declare type ChamferTypes = 'Equal_Distance' | 'Two_Distances' | 'Distance_And_Angle';
1006
- declare type PickTypes = 'vertex' | 'edge' | 'face';
1007
1126
  declare type DataTypes = 'of1' | 'stp' | 'step';
1008
1127
  declare type SupportedImportFormats = 'STEP' | 'STP' | 'SAT' | 'IWB' | 'IWP' | 'IWC' | 'IGS' | 'STL' | 'DXF' | 'DWG';
1009
- declare type DimTypes = 'LinearDimension';
1010
- declare type ViewTypes = 'Top' | 'Front' | 'Right' | 'Left' | 'Bottom' | 'Right_90°' | 'Left_90°' | 'Back' | 'Iso';
1011
- export declare type OrientationTypes = 'Horizontal' | 'Vertical';
1012
1128
  export declare type DimensionType = {
1013
- productId: number;
1129
+ productId: VID;
1014
1130
  dimParam: {
1015
- dimType: DimTypes;
1131
+ dimType: 'LinearDimension';
1016
1132
  dimName?: string;
1017
1133
  dimLabel: string;
1018
1134
  dimValue?: number | null;
@@ -1020,11 +1136,11 @@ export declare type DimensionType = {
1020
1136
  dimEndPos: PointMemValue;
1021
1137
  dimTextPos: PointMemValue;
1022
1138
  dimTextAngle: number;
1023
- dimOrientation: OrientationTypes;
1139
+ dimOrientation: OrientationType;
1024
1140
  dimColor?: number;
1025
1141
  dimLayer?: string;
1026
1142
  };
1027
- dxfView: ViewTypes;
1143
+ dxfView: ViewType;
1028
1144
  };
1029
1145
  /**
1030
1146
  * Information about constraint.