@buerli.io/headless 0.7.1 → 0.9.0-beta.1

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,7 +1,6 @@
1
- import { BooleanOperationType, ChamferType, FlipType, ReorientedType, WorkAxisType, WorkCoordSystemType, WorkPlaneType, WorkPointType, ViewType, OrientationType, ExtrusionType, BrepElemType, WorkGeomType, SVGModusType, LimitsParam, LimitedValue } from '@buerli.io/classcad';
2
- import { ObjectIdent, ObjectID, PointMemValue } from '@buerli.io/core';
1
+ import { BooleanOperationType, ChamferType, FlipType, ReorientedType, WorkAxisType, WorkCoordSystemType, WorkPlaneType, WorkPointType, ViewType, OrientationType, ExtrusionType, WorkGeomType, SVGModusType, LimitsParam, LimitedValue } from '@buerli.io/classcad';
2
+ import { DrawingID, ObjectIdent, ObjectID, PointMemValue, GraphicType, InteractionInfo, AnyGeometryElement } from '@buerli.io/core';
3
3
  import { BufferGeometry, Material, Object3D, Scene } from 'three';
4
- export declare type Vec = number[] | PointMemValue | THREE.Vector3 | THREE.Euler;
5
4
  /**
6
5
  * History based modeling is similar to solid modeling, but it is non-destructive and
7
6
  * parametric. You can move back and forth in the modeling history and create feature
@@ -26,16 +25,19 @@ export declare type Vec = number[] | PointMemValue | THREE.Vector3 | THREE.Euler
26
25
  */
27
26
  export declare type ApiHistory = {
28
27
  /**
29
- * Adds multiple products as nodes to an existing assembly at once
30
- * @param nodes array of node parameter objects. See following descriptions.
31
- * @param productId id or identifier of the product template to add
32
- * @param ownerId id or identifier of the owner where the product template will be added to
33
- * @param transformation transformation of the product template in x-, y- and z-axis
34
- * @param name optional name for adding node
35
- * @param options optional object containing ident property, to define a identifier for the added node
28
+ * Adds products as instances to root assembly, assembly instance or assembly template.
29
+ * - If the owner is an instance in the expanded tree, its template in the assembly container will also be updated.
30
+ * - If the onwer is an assembly template, all instances of the template will also be updated
31
+ * @param instances array of objects containing the information of "to add" instances. See following parameter descriptions.
32
+ * @param productId id or identifier of the product to instantiate
33
+ * @param ownerId id or identifier of the owner of to adding instance, owner can be root assembly, assembly instance or assembly template.
34
+ * @param transformation transformation (origin, x-Dir, y-Dir) of the instance
35
+ * @param name optional name for the instance
36
+ * @param options optional object containing ident property, to define a identifier for the adding instance
37
+ * @return array containing the ids of added instances direct to owner
36
38
  * @example // tbd
37
39
  */
38
- addNodes: (...nodes: {
40
+ addInstances: (...instances: {
39
41
  productId: VID | ObjectIdent;
40
42
  ownerId: VID | ObjectIdent;
41
43
  transformation: Transform;
@@ -82,7 +84,7 @@ export declare type ApiHistory = {
82
84
  *
83
85
  * // Add the dimensions
84
86
  * const dimensionIds = await api.addDimensions(dimension1, dimension2)
85
- * @return array of ids of the added dimensions
87
+ * @return array containing the ids of added dimensions
86
88
  */
87
89
  addDimensions: (...dimensions: {
88
90
  productId: VID;
@@ -115,6 +117,7 @@ export declare type ApiHistory = {
115
117
  *
116
118
  * // Create the wanted views
117
119
  * await api.create2DViews(productId, [ViewType.TOP, ViewType.RIGHT_90, ViewType.ISO], { color: 2, layer: '6'})
120
+ * @return array containing the ids of created views
118
121
  */
119
122
  create2DViews: (productId: VID, viewTypes: ViewType[], viewOptions?: ViewOptionsType) => IDs;
120
123
  /**
@@ -127,6 +130,7 @@ export declare type ApiHistory = {
127
130
  *
128
131
  * // Returns for each view a min and max point
129
132
  * console.info(bbs) // [[{x: -105, y: -89, z: 0}, {x: 105, y: 55, z: 0}], [...], [...]]
133
+ * @return array of tuples, each tuple contains a min and max value for one of the given view types. The min an max values represent a Vector with x-, y- and z-coordinates.
130
134
  */
131
135
  getBoundaryBoxFromViews: (productId: VID, viewTypes?: ViewType[]) => Promise<[Vec, Vec][]>;
132
136
  /**
@@ -176,23 +180,25 @@ export declare type ApiHistory = {
176
180
  }, dxfTemplateFilename?: string) => Promise<Uint8Array | null>;
177
181
  /**
178
182
  * Remove existing dimensions from the view.
179
- * @param dimensionsIds ids of the dimensions to be removed
183
+ * @param dimensionIds ids of the dimensions to be removed
180
184
  * @example
181
185
  * // You can remove existing dimensions
182
186
  * await api.removeDimensions(dimensionIds)
183
187
  */
184
188
  removeDimensions: (dimensionIds: VID[]) => Promise<void>;
185
189
  /**
186
- * Creates a linear pattern
190
+ * Creates a linear pattern operation
187
191
  * @param partId Id of the part to create the linear pattern in.
188
- * @param entities included entities of linear operation.
192
+ * @param operations ids of the operations which are used for this linear pattern operation,
193
+ * e.g. box, extrusion, chamfer operation
189
194
  * @param references1 references for the first axis of the pattern. E.g. edge / work axis or 2 vertices / work points
190
195
  * @param params1 parameter object which includes inverted flag, distance, count and merged flag
191
196
  * for the first direction of the pattern.
192
197
  * @param references2 optional references for the second axis of the pattern.
193
198
  * @param params2 optional parameter object for second direction of pattern.
199
+ * @return id of the linear pattern operation
194
200
  */
195
- linearPattern: (partId: VID, entities: VID[], references1: VID[], params1: {
201
+ linearPattern: (partId: VID, operations: VID[], references1: VID[], params1: {
196
202
  inverted: 0 | 1;
197
203
  distance: number | string;
198
204
  count: number | string;
@@ -203,20 +209,22 @@ export declare type ApiHistory = {
203
209
  count: number | string;
204
210
  }) => ID;
205
211
  /**
206
- * Creates a circular pattern
212
+ * Creates a circular pattern operation
207
213
  * @param partId Id of the part to create the circular pattern in.
208
- * @param entities included entities of circular operation.
214
+ * @param operations ids of the operations which are used for this circular pattern operation,
215
+ * e.g. box, extrusion, chamfer operation
209
216
  * @param references references for the rotation axis of the pattern. E.g. edge / work axis or 2 vertices / work points
210
217
  * @param params parameter object which includes inverted flag, angle, count and merged flag.
218
+ * @return id of the circular pattern operation
211
219
  */
212
- circularPattern: (partId: VID, entities: VID[], references: VID[], params: {
220
+ circularPattern: (partId: VID, operations: VID[], references: VID[], params: {
213
221
  inverted: 0 | 1;
214
222
  angle: number | string;
215
223
  count: number | string;
216
224
  merged: 0 | 1;
217
225
  }) => ID;
218
226
  /**
219
- * Creates an extrusion
227
+ * Creates an extrusion operation
220
228
  * @param partId Id of the part to create the extrusion in.
221
229
  * @param sketchOrRegionIds Id of the sketch to extrude or multiple ids of sketch regions
222
230
  * @param type Type of extrusion (up, down, symmetric, custom)
@@ -225,23 +233,27 @@ export declare type ApiHistory = {
225
233
  * @param taperAngle Angle of taper for extrusion
226
234
  * @param direction Direction of extrusion
227
235
  * @param capEnds If true, ends will be capped, else a sheet will be created
236
+ * @return id of the extrusion operation
228
237
  */
229
238
  extrusion: (partId: VID, sketchOrRegionIds: VID | VIDs, type: ExtrusionType, limit1: number | string, limit2: number | string, taperAngle: number | string, direction: Vec, capEnds: 0 | 1) => ID;
230
239
  /**
231
- * Creates a revolve
240
+ * Creates a revolve operation
232
241
  * @param partId Id of the part to create the revolve in.
233
242
  * @param sketchOrRegionIds Id of the sketch to extrude or multiple ids of sketch regions
234
243
  * @param axisIds Array of ids, either [lineId] or [point1Id, point2Id], ids can be both ccId or graphicId
235
244
  * @param angle1 Start of revolve in degrees
236
245
  * @param angle2 End of revolve in degrees
237
246
  * @param inverted flag, whether to invert the axis or not
247
+ * @return id of the revolve operation
238
248
  */
239
249
  revolve: (partId: VID, sketchOrRegionIds: VID | VIDs, axisIds: VID[], angle1: number | string, angle2: number | string, inverted: 0 | 1) => ID;
240
250
  /**
241
251
  * Creates a boolean operation.
242
252
  * @param partId id of the part where the operation will be created on
243
253
  * @param type type of boolean operation.
244
- * @param entities included entities of boolean operation, first entity is base entity
254
+ * @param operations ids of the operations for this boolean operation, e.g. Box, Chamfer.
255
+ * At least two operations are needed. First operation in the array is the basic operation,
256
+ * all following are the tool operations, which will be unified, subtract or intersect with/from the first operation.
245
257
  * @example
246
258
  * // Creates a box and subtracts a cylinder from it
247
259
  * const part = api.createPart('Part')
@@ -250,10 +262,11 @@ export declare type ApiHistory = {
250
262
  * api.boolean(part, BooleanOperationType.Subtraction, [box, cyl])
251
263
  * const geoms = await api.createBufferGeometry(part)
252
264
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
265
+ * @return id of the boolean operation
253
266
  */
254
- boolean: (partId: VID, type: BooleanOperationType, entities: VID[]) => ID;
267
+ boolean: (partId: VID, type: BooleanOperationType, operations: VID[]) => ID;
255
268
  /**
256
- * Creates a simple box entity
269
+ * Creates a box operation
257
270
  * @param partId id of the part where the box will be created
258
271
  * @param references reference of work coordinate system to place the box at
259
272
  * @param length length of the box (x-axis)
@@ -265,10 +278,11 @@ export declare type ApiHistory = {
265
278
  * const box = api.box(part, [], 20, 20, 20)
266
279
  * const geoms = await api.createBufferGeometry(part)
267
280
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
281
+ * @return id of the box operation
268
282
  */
269
283
  box: (partId: VID, references: VID[], width: number | string, length: number | string, height: number | string) => ID;
270
284
  /**
271
- * Creates a simple cylinder entity
285
+ * Creates a cylinder operation
272
286
  * @param partId id of the part where the cylinder will be created
273
287
  * @param references reference of work coordinate system to place the cylinder at
274
288
  * @param diameter diameter of the cylinder (x/y-axis)
@@ -279,10 +293,11 @@ export declare type ApiHistory = {
279
293
  * api.cylinder(part, [], 20, 50)
280
294
  * const geoms = await api.createBufferGeometry(part)
281
295
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
296
+ * @return id of the cylinder operation
282
297
  */
283
298
  cylinder: (partId: VID, references: VID[], diameter: number | string, height: number | string) => ID;
284
299
  /**
285
- * Creates a chamfer at the given edge references.
300
+ * Creates a chamfer operation
286
301
  * @param partId id of the part where the chamfers will be created
287
302
  * @param type type of chamfer operation.
288
303
  * @param references edge references where the chmamfers will be created on
@@ -297,10 +312,11 @@ export declare type ApiHistory = {
297
312
  * api.chamfer(part, ChamferType.Equal_Distance, bottomEdges, 2, 0, 0)
298
313
  * const geoms = await api.createBufferGeometry(part)
299
314
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
315
+ * @return id of the chamfer operation
300
316
  */
301
317
  chamfer: (partId: VID, type: ChamferType, references: VIDs, dist1: number | string, dist2: number | string, angle: number | string) => ID;
302
318
  /**
303
- * Creates a simple cone entity.
319
+ * Creates a cone operation.
304
320
  * @param partId id of the part where the cone will be created
305
321
  * @param references reference of work coordinate system to place the cone at
306
322
  * @param bDiameter bottom diameter of the cone
@@ -312,11 +328,12 @@ export declare type ApiHistory = {
312
328
  * api.cone(part, [], 20, 0, 20)
313
329
  * const geoms = await api.createBufferGeometry(part)
314
330
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
331
+ * @return id of the cone operation
315
332
  */
316
333
  cone: (partId: VID, references: VID[], bDiameter: number | string, tDiameter: number | string, height: number | string) => ID;
317
334
  /**
318
335
  * Creates a fastened constraint between mate1 and mate2 within an assembly.
319
- * @param asmId id of the assembly to create constraints on
336
+ * @param id id of the root assembly or an assembly template to create constraints on
320
337
  * @param mate1 contains the mate path ids to its 1st part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
321
338
  * @param mate2 contains the mate path ids to its 2nd part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
322
339
  * @param xOffset defines a offset in x-axis from mate1 to mate2
@@ -338,28 +355,29 @@ export declare type ApiHistory = {
338
355
  *
339
356
  * // Creates a part template and adds geometry to it
340
357
  * const partTempl1 = await api.createPartAsTemplate('Part_Template1')
341
- * const wcs1 = await api.createWorkCoordSystem(partTempl1, 'Custom', [], offset1, rot, 0, false, 'wcs1')
342
- * const wcs3 = await api.createWorkCoordSystem(partTempl1, 'Custom', [], offset3, rot, 0, false, 'wcs3')
358
+ * const wcs1 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset1, rot, false, 'wcs1')
359
+ * const wcs3 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset3, rot, false, 'wcs3')
343
360
  * api.box(partTempl1, [wcs1], 30, 30, 30)
344
361
  *
345
362
  * // Creates another part template and adds geometry to it
346
363
  * const partTempl2 = await api.createPartAsTemplate('Part_Template2')
347
- * const wcs2 = await api.createWorkCoordSystem(partTempl2, 'Custom', [], offset2, rot, 0, false, 'wcs2')
364
+ * const wcs2 = await api.createWorkCoordSystem(partTempl2, WorkCoordSystemType.WCS_Custom, [], offset2, rot, false, 'wcs2')
348
365
  * api.cone(partTempl2, [wcs2], 30, 0.1, 30)
349
366
  *
350
- * // Adds the created part templates as nodes to the root assembly
351
- * const prt1 = await api.addNode(partTempl1, rootAsm, [orig, xDir, yDir])
352
- * const prt2 = await api.addNode(partTempl2, rootAsm, [orig, xDir, yDir])
367
+ * // Adds the created part templates as instances to the root assembly
368
+ * const prt1 = await api.addInstances(partTempl1, rootAsm, [orig, xDir, yDir])
369
+ * const prt2 = await api.addInstances(partTempl2, rootAsm, [orig, xDir, yDir])
353
370
  *
354
- * // Creates a fastened constraint between the nodes
371
+ * // Creates a fastened constraint between the instances
355
372
  * await api.createFastenedConstraint(rootAsm, { matePath: [prt1], wcsId: wcs3 }, { matePath: [prt2], wcsId: wcs2 }, 0, 0, 0, 0, 0, 'FC')
356
373
  * const geoms = await api.createBufferGeometry(rootAsm)
357
374
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
375
+ * @return id of the fastened constraint
358
376
  */
359
- createFastenedConstraint: (asmId: VID, mate1: MateParam, mate2: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => Promise<ObjectID | null>;
377
+ createFastenedConstraint: (id: VID, mate1: MateParam, mate2: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => Promise<ObjectID | null>;
360
378
  /**
361
379
  * Updates multiple fastened constraints
362
- * @param constraints array of constraint parameter objects. See following descriptions.
380
+ * @param constraints array of constraint parameter objects. See following parameter descriptions.
363
381
  * @param mate1 contains the mate path ids to its 1st part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
364
382
  * @param mate2 contains the mate path ids to its 2nd part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
365
383
  * @param xOffset defines a offset in x-axis from mate1 to mate2
@@ -377,7 +395,7 @@ export declare type ApiHistory = {
377
395
  }[]) => Promise<void>;
378
396
  /**
379
397
  * Creates a fastened origin constraint for mate1 to the origin (0, 0, 0).
380
- * @param asmId id of the assembly to create constraints on
398
+ * @param id id of the root assembly or an assembly template to create constraints on
381
399
  * @param mate1 contains the mate path ids to its part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
382
400
  * @param xOffset defines a offset in x-axis from mate1 to mate2
383
401
  * @param yOffset defines a offset in y-axis from mate1 to mate2
@@ -397,20 +415,21 @@ export declare type ApiHistory = {
397
415
  *
398
416
  * // Creates a part template and adds geometry to it
399
417
  * const partTempl = await api.createPartAsTemplate('Part_Template')
400
- * const wcs1 = await api.createWorkCoordSystem(partTempl, 'Custom', [], offset1, rot, 0, false, 'wcs')
401
- * const wcs2 = await api.createWorkCoordSystem(partTempl, 'Custom', [], offset2, rot, 0, false, 'wcs')
418
+ * const wcs1 = await api.createWorkCoordSystem(partTempl, WorkCoordSystemType.WCS_Custom, [], offset1, rot, false, 'wcs')
419
+ * const wcs2 = await api.createWorkCoordSystem(partTempl, WorkCoordSystemType.WCS_Custom, [], offset2, rot, false, 'wcs')
402
420
  * api.box(partTempl, [wcs1], 30, 30, 30)
403
421
  *
404
- * // Adds the created part template as a node to the root assembly
405
- * const prt = await api.addNode(partTempl, rootAsm, [orig, xDir, yDir])
422
+ * // Adds the created part template as an instance to the root assembly
423
+ * const prt = await api.addInstances(partTempl, rootAsm, [orig, xDir, yDir])
406
424
  *
407
425
  * // Creates a fastened origin constraint. The box of the part will be centered in origin
408
426
  * await api.createFastenedOriginConstraint(rootAsm, { matePath: [prt], wcsId: wcs2 }, 0, 0, 0, 0, 0, 'FOC')
409
427
  *
410
428
  * const geoms = await api.createBufferGeometry(rootAsm)
411
429
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial({ transparent: true, opacity: 0.5 })))
430
+ * @return id of the fastened origin constraint
412
431
  */
413
- createFastenedOriginConstraint: (asmId: VID, mate1: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => Promise<ObjectID | null>;
432
+ createFastenedOriginConstraint: (id: VID, mate1: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => Promise<ObjectID | null>;
414
433
  /**
415
434
  * Updates multiple fastened origin constraints
416
435
  * @param constraints array of constraint parameter objects. See following descriptions.
@@ -429,15 +448,16 @@ export declare type ApiHistory = {
429
448
  }[]) => Promise<void>;
430
449
  /**
431
450
  * Creates a cylindrical constraint between mate1 and mate2 within an assembly.
432
- * @param asmId id of the assembly to create constraints on
451
+ * @param id id of the root assembly or an assembly template to create constraints on
433
452
  * @param mate1 contains the mate path ids to its part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
434
453
  * @param mate2 contains the mate path ids to its 2nd part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
435
454
  * @param zOffsetLimits min and max value of offset along z
436
455
  * @param zRotationLimits min and max value of rotation around z
437
456
  * @param name name of the constraint
438
457
  * @example // tbd
458
+ * @return id of the cylindrical constraint
439
459
  */
440
- createCylindricalConstraint: (asmId: VID, mate1: MateParam, mate2: MateParam, zOffsetLimits: LimitsParam, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
460
+ createCylindricalConstraint: (id: VID, mate1: MateParam, mate2: MateParam, zOffsetLimits: LimitsParam, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
441
461
  /**
442
462
  * Updates multiple cylindrical constraints.
443
463
  * @param constraints array of constraint parameter objects. See following descriptions.
@@ -457,15 +477,16 @@ export declare type ApiHistory = {
457
477
  }[]) => Promise<void>;
458
478
  /**
459
479
  * Creates a revolute constraint between mate1 and mate2 within an assembly.
460
- * @param asmId id of the assembly to create constraints on
480
+ * @param id id of the root assembly or an assembly template to create constraints on
461
481
  * @param mate1 contains the mate path ids to its part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
462
482
  * @param mate2 contains the mate path ids to its 2nd part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
463
483
  * @param zOffset defines a offset in z-axis from mate1 to mate2
464
484
  * @param zRotationLimits min and max value of rotation around z
465
485
  * @param name name of the constraint
466
486
  * @example // tbd
487
+ * @return id of the revolute constraint
467
488
  */
468
- createRevoluteConstraint: (asmId: VID, mate1: MateParam, mate2: MateParam, zOffset: number | string, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
489
+ createRevoluteConstraint: (id: VID, mate1: MateParam, mate2: MateParam, zOffset: number | string, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
469
490
  /**
470
491
  * Updates multiple revolute constraints.
471
492
  * @param constraints array of constraint parameter objects. See following descriptions.
@@ -485,7 +506,7 @@ export declare type ApiHistory = {
485
506
  }[]) => Promise<void>;
486
507
  /**
487
508
  * Creates a slider constraint between mate1 and mate2 within an assembly.
488
- * @param asmId id of the assembly to create constraints on
509
+ * @param id id of the root assembly or an assembly template to create constraints on
489
510
  * @param mate1 contains the mate path ids to its part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
490
511
  * @param mate2 contains the mate path ids to its 2nd part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
491
512
  * @param xOffset defines a offset in x-axis from mate1 to mate2
@@ -493,8 +514,9 @@ export declare type ApiHistory = {
493
514
  * @param zOffsetLimits min and max value of offset along z
494
515
  * @param name name of the constraint
495
516
  * @example // tbd
517
+ * @return id of the slider constraint
496
518
  */
497
- createSliderConstraint: (asmId: VID, mate1: MateParam, mate2: MateParam, xOffset: number | string, yOffset: number | string, zOffsetLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
519
+ createSliderConstraint: (id: VID, mate1: MateParam, mate2: MateParam, xOffset: number | string, yOffset: number | string, zOffsetLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
498
520
  /**
499
521
  * Updates multiple slider constraints.
500
522
  * @param constraints array of constraint parameter objects. See following descriptions.
@@ -516,7 +538,7 @@ export declare type ApiHistory = {
516
538
  }[]) => Promise<void>;
517
539
  /**
518
540
  * Creates a planar constraint between mate1 and mate2 within an assembly.
519
- * @param asmId id of the assembly to create constraints on
541
+ * @param id id of the root assembly or an assembly template to create constraints on
520
542
  * @param mate1 contains the mate path ids to its part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
521
543
  * @param mate2 contains the mate path ids to its 2nd part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
522
544
  * @param zOffset defines a offset in z-axis from mate1 to mate2
@@ -525,8 +547,9 @@ export declare type ApiHistory = {
525
547
  * @param zRotationLimits min and max value of rotation around z
526
548
  * @param name name of the constraint
527
549
  * @example // tbd
550
+ * @return id of the planar constraint
528
551
  */
529
- createPlanarConstraint: (asmId: VID, mate1: MateParam, mate2: MateParam, zOffset: number | string, xOffsetLimits: LimitsParam, yOffsetLimits: LimitsParam, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
552
+ createPlanarConstraint: (id: VID, mate1: MateParam, mate2: MateParam, zOffset: number | string, xOffsetLimits: LimitsParam, yOffsetLimits: LimitsParam, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
530
553
  /**
531
554
  * Updates multiple planar constraints.
532
555
  * @param constraints array of constraint parameter objects. See following descriptions.
@@ -550,7 +573,7 @@ export declare type ApiHistory = {
550
573
  }[]) => Promise<void>;
551
574
  /**
552
575
  * Creates a parallel constraint between mate1 and mate2 within an assembly.
553
- * @param asmId id of the assembly to create constraints on
576
+ * @param id id of the root assembly or an assembly template to create constraints on
554
577
  * @param mate1 contains the mate path ids to its part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
555
578
  * @param mate2 contains the mate path ids to its 2nd part and its work coordinate system id, and also the flip (0-5) and reoriented (0-3) states
556
579
  * @param xOffsetLimits min and max value of offset along x
@@ -559,8 +582,9 @@ export declare type ApiHistory = {
559
582
  * @param zRotationLimits min and max value of rotation around z
560
583
  * @param name name of the constraint
561
584
  * @example // tbd
585
+ * @return id of the parallel constraint
562
586
  */
563
- createParallelConstraint: (asmId: VID, mate1: MateParam, mate2: MateParam, xOffsetLimits: LimitsParam, yOffsetLimits: LimitsParam, zOffsetLimits: LimitsParam, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
587
+ createParallelConstraint: (id: VID, mate1: MateParam, mate2: MateParam, xOffsetLimits: LimitsParam, yOffsetLimits: LimitsParam, zOffsetLimits: LimitsParam, zRotationLimits: LimitsParam, name: string) => Promise<ObjectID | null>;
564
588
  /**
565
589
  * Updates multiple parallel constraints.
566
590
  * @param constraints array of constraint parameter objects. See following descriptions.
@@ -584,6 +608,10 @@ export declare type ApiHistory = {
584
608
  }[]) => Promise<void>;
585
609
  /**
586
610
  * Updates limited value specified (with 'paramName') of multiple constraints
611
+ * @param constrValues array of constraint value objects. See following parameter description for that.
612
+ * @param constrId id of the constraint to update the limited value
613
+ * @param paramName name of the limited parameter
614
+ * @param value new value to set
587
615
  */
588
616
  update3dConstraintValues: (...constrValues: {
589
617
  constrId: VID;
@@ -591,7 +619,7 @@ export declare type ApiHistory = {
591
619
  value: number;
592
620
  }[]) => Promise<void>;
593
621
  /**
594
- * Creates the buffer geometry of the product (part or assembly).
622
+ * Creates the buffer geometry of any product (part or assembly).
595
623
  * @param productId id of the product to create buffer geometry from
596
624
  * @example
597
625
  * // Creates a cone with bottom diameter = 20, top diameter = 0 and height = 30
@@ -599,15 +627,16 @@ export declare type ApiHistory = {
599
627
  * api.cone(part, [], 20, 0, 30)
600
628
  * const geoms = await api.createBufferGeometry(part)
601
629
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
630
+ * @return array of buffer geometry
602
631
  */
603
632
  createBufferGeometry: (productId: VID) => Promise<BufferGeometry[] | undefined>;
604
633
  /**
605
- * Creates ThreeJS scene from current product
634
+ * Creates the threeJS scene of any product (part or assembly).
606
635
  * @param productId id of the product to create scene from
607
636
  * @param options optional object to define different settings.
608
637
  * @param meshPerGeometry boolean flag to define if a part/solid will have a mesh for each
609
638
  * geometry element or if the elements will be merged to one mesh
610
- * @return object containing all the created THREE objects like scene, nodes, solids and meshes
639
+ * @return object containing all the created THREE objects like scene, nodes and materials
611
640
  * @example // tbd
612
641
  */
613
642
  createScene: (productId?: VID, options?: {
@@ -624,7 +653,7 @@ export declare type ApiHistory = {
624
653
  }>;
625
654
  /**
626
655
  * Creates one or more expressions.
627
- * @param partId id or identifier of part where to create the expression
656
+ * @param partId id or identifier of the part to create the expressions in
628
657
  * @param members array of members which contain a name and a value. Value can be an expression, e.g. '2 * laenge'
629
658
  * @example
630
659
  * // Creates an expression and links it with the width of the box
@@ -633,13 +662,16 @@ export declare type ApiHistory = {
633
662
  * api.box(part, [], 'ExpressionSet.width', 20, 20)
634
663
  * const geoms = await api.createBufferGeometry(part)
635
664
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
665
+ * @return true or false, depending on whether creating the expressions was successful or not
636
666
  */
637
667
  createExpressions: (partId: VID | ObjectIdent, ...members: {
638
668
  name: string;
639
669
  value: number | string;
640
670
  }[]) => Promise<boolean>;
641
671
  /**
642
- * Creates a new assembly template. This template can be used multiple times as a sub assembly in the root assembly.
672
+ * Creates a new assembly template. This template will be added to the assembly container
673
+ * and can be instantiated multiple times as a sub assembly in the root assembly or in other assembly template.
674
+ * Assembly templates can only be created if the root is already an assembly.
643
675
  * @param name [optional] name of the assembly template. Default = 'Assembly'
644
676
  * @example
645
677
  * // Defines some consts
@@ -659,29 +691,30 @@ export declare type ApiHistory = {
659
691
  *
660
692
  * // Creates a part template and adds geometry to it
661
693
  * const partTempl1 = await api.createPartAsTemplate('Part_Template1')
662
- * const wcs1 = await api.createWorkCoordSystem(partTempl1, 'Custom', [], offset1, rot, 0, false, 'wcs1')
694
+ * const wcs1 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset1, rot, false, 'wcs1')
663
695
  * api.box(partTempl1, [wcs1], 30, 30, 30)
664
696
  *
665
697
  * // Creates another part template and adds geometry to it
666
698
  * const partTempl2 = await api.createPartAsTemplate('Part_Template2')
667
- * const wcs2 = await api.createWorkCoordSystem(partTempl2, 'Custom', [], offset2, rot, 0, false, 'wcs2')
699
+ * const wcs2 = await api.createWorkCoordSystem(partTempl2, WorkCoordSystemType.WCS_Custom, [], offset2, rot, false, 'wcs2')
668
700
  * api.cone(partTempl2, [wcs2], 30, 0.1, 30)
669
701
  *
670
- * // Adds the created part templates as nodes to the assembly
702
+ * // Adds the created part templates as instances to the assembly
671
703
  * // and the assembly itself multiple times to the root assembly
672
- * const prt1 = await api.addNode(partTempl1, asmTempl, [orig, xDir, yDir])
673
- * const prt2 = await api.addNode(partTempl2, asmTempl, [orig, xDir, yDir])
674
- * const asm1 = await api.addNode(asmTempl, rootAsm, [orig, xDir, yDir])
675
- * const asm2 = await api.addNode(asmTempl, rootAsm, [offset3, xDir, yDir])
704
+ * const prt1 = await api.addInstances(partTempl1, asmTempl, [orig, xDir, yDir])
705
+ * const prt2 = await api.addInstances(partTempl2, asmTempl, [orig, xDir, yDir])
706
+ * const asm1 = await api.addInstances(asmTempl, rootAsm, [orig, xDir, yDir])
707
+ * const asm2 = await api.addInstances(asmTempl, rootAsm, [offset3, xDir, yDir])
676
708
  *
677
709
  * const geoms = await api.createBufferGeometry(rootAsm)
678
710
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
711
+ * @return id of the assembly template
679
712
  */
680
713
  createAssemblyAsTemplate: (name?: string) => ID;
681
714
  /**
682
- * Creates a new rootAssembly. This is the top level assembly.
715
+ * Creates a new root assembly. This is the top level assembly.
683
716
  * @param name [optional] name of the root assembly. Default = 'AssemblyRoot'
684
- * @param options optional object containing ident property, to define a identifier for the created root assembly
717
+ * @param options optional object containing ident property to define an identifier for the created root assembly
685
718
  * @example
686
719
  * // Defines some consts
687
720
  * const orig = { x: 0, y: 0, z: 0 }
@@ -695,19 +728,20 @@ export declare type ApiHistory = {
695
728
  *
696
729
  * // Creates a part template and adds geometry to it
697
730
  * const partTempl = await api.createPartAsTemplate('Part_Template')
698
- * const wcs = await api.createWorkCoordSystem(partTempl, 'Custom', [], offset, rot, 0, false, 'wcs')
731
+ * const wcs = await api.createWorkCoordSystem(partTempl, WorkCoordSystemType.WCS_Custom, [], offset, rot, false, 'wcs')
699
732
  * api.box(partTempl, [wcs], 30, 30, 10)
700
733
  *
701
- * // Adds the created part template as a node to the root assembly
702
- * const partRef = await api.addNode(partTempl, rootAsm, [orig, xDir, yDir])
734
+ * // Adds the created part template as an instance to the root assembly
735
+ * const partRef = await api.addInstances(partTempl, rootAsm, [orig, xDir, yDir])
703
736
  * const geoms = await api.createBufferGeometry(rootAsm)
704
737
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
738
+ * @return id of the root assembly
705
739
  */
706
740
  createRootAssembly: (name?: string, options?: {
707
741
  ident?: ObjectIdent;
708
742
  }) => ID;
709
743
  /**
710
- * Creates a new part.
744
+ * Creates a new root part. This is the top level part.
711
745
  * @param name [optional] name of the part. Default = 'Part'
712
746
  * @example
713
747
  * // Creates a box and subtracts a cylinder from it
@@ -715,10 +749,13 @@ export declare type ApiHistory = {
715
749
  * api.cylinder(part, [], 10, 100)
716
750
  * const geoms = await api.createBufferGeometry(part)
717
751
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
752
+ * @return id of the root part
718
753
  */
719
754
  createPart: (name?: string) => ID;
720
755
  /**
721
- * Creates a new part template. This template can be used multiple times to build assemblies.
756
+ * Creates a new part template. This template will be added to the part container
757
+ * and can be instantiated multiple times in the root assembly or in assembly templates.
758
+ * Part templates can only be created if the root is already an assembly.
722
759
  * @param name [optional] name of the part. Default = 'Part'
723
760
  * @example
724
761
  * // Defines some consts
@@ -733,13 +770,14 @@ export declare type ApiHistory = {
733
770
  *
734
771
  * // Creates a part template and adds geometry to it
735
772
  * const partTempl = await api.createPartAsTemplate('Part_Template')
736
- * const wcs = await api.createWorkCoordSystem(partTempl, 'Custom', [], offset, rot, 0, false, 'wcs')
773
+ * const wcs = await api.createWorkCoordSystem(partTempl, WorkCoordSystemType.WCS_Custom, [], offset, rot, false, 'wcs')
737
774
  * api.box(partTempl, [wcs], 30, 30, 10)
738
775
  *
739
- * // Adds the created part template as a node to the root assembly
740
- * const partRef = await api.addNode(partTempl, rootAsm, [orig, xDir, yDir])
776
+ * // Adds the created part template as an instance to the root assembly
777
+ * const partRef = await api.addInstances(partTempl, rootAsm, [orig, xDir, yDir])
741
778
  * const geoms = await api.createBufferGeometry(rootAsm)
742
779
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
780
+ * @return id of the part template
743
781
  */
744
782
  createPartAsTemplate: (name?: string) => ID;
745
783
  /**
@@ -752,6 +790,7 @@ export declare type ApiHistory = {
752
790
  * @param local if true, work axis is set in local coordinates of part???
753
791
  * @param name name of the work axis, if not set default name = 'WorkAxis'
754
792
  * @example //tbd
793
+ * @return id of the work axis
755
794
  */
756
795
  createWorkAxis: (partId: VID, type: WorkAxisType, references: VID[], position: Vec, direction: Vec, local: boolean, name?: string) => ID;
757
796
  /**
@@ -761,8 +800,7 @@ export declare type ApiHistory = {
761
800
  * @param references references for the work coordinate system (point and 2 axis). If empty array, the work coordinate system will set to origin (0, 0, 0)
762
801
  * @param offset offset from work coordinate system in x-, y- and z-direction
763
802
  * @param rotation rotation around x-, y- and z-axis from work coordinate system
764
- * @param inverted inverts the constraint between mate1 and mate2
765
- * @param local if true, work coordinate system is set in local coordinates of part???
803
+ * @param inverted inverts the direction of the primary axis
766
804
  * @param name name of the work coordinate system, if not set default name = 'WorkCoordSystem'
767
805
  * @example
768
806
  * // Defines some consts
@@ -779,25 +817,26 @@ export declare type ApiHistory = {
779
817
  *
780
818
  * // Creates a part template and adds geometry to it
781
819
  * const partTempl1 = await api.createPartAsTemplate('Part_Template1')
782
- * const wcs1 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset1, rot, 0, false, 'wcs1')
783
- * const wcs3 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset3, rot, 0, false, 'wcs3')
820
+ * const wcs1 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset1, rot, false, 'wcs1')
821
+ * const wcs3 = await api.createWorkCoordSystem(partTempl1, WorkCoordSystemType.WCS_Custom, [], offset3, rot, false, 'wcs3')
784
822
  * api.box(partTempl1, [wcs1], 30, 30, 30)
785
823
  *
786
824
  * // Creates another part template and adds geometry to it
787
825
  * const partTempl2 = await api.createPartAsTemplate('Part_Template2')
788
- * const wcs2 = await api.createWorkCoordSystem(partTempl2, WorkCoordSystemType.WCS_Custom, [], offset2, rot, 0, false, 'wcs2')
826
+ * const wcs2 = await api.createWorkCoordSystem(partTempl2, WorkCoordSystemType.WCS_Custom, [], offset2, rot, false, 'wcs2')
789
827
  * api.cone(partTempl2, [wcs2], 30, 0.1, 30)
790
828
  *
791
- * // Adds the created part templates as nodes to the root assembly
792
- * const prt1 = await api.addNode(partTempl1, rootAsm, [orig, xDir, yDir])
793
- * const prt2 = await api.addNode(partTempl2, rootAsm, [orig, xDir, yDir])
829
+ * // Adds the created part templates as instances to the root assembly
830
+ * const prt1 = await api.addInstances(partTempl1, rootAsm, [orig, xDir, yDir])
831
+ * const prt2 = await api.addInstances(partTempl2, rootAsm, [orig, xDir, yDir])
794
832
  *
795
- * // Creates a fastened constraint between the nodes
833
+ * // Creates a fastened constraint between the instances
796
834
  * await api.createFastenedConstraint(rootAsm, { matePath: [prt1], wcsId: wcs3 }, { matePath: [prt2], wcsId: wcs2 }, 0, 0, 0, 0, 0, 'FC')
797
835
  * const geoms = await api.createBufferGeometry(rootAsm)
798
836
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
837
+ * @return id of the work coordinate system
799
838
  */
800
- createWorkCoordSystem: (partId: VID, type: WorkCoordSystemType, references: VID[], coordinateSystem: Vec[], offset: Vec, rotation: Vec, inverted: boolean, local: boolean, name?: string) => ID;
839
+ createWorkCoordSystem: (partId: VID, type: WorkCoordSystemType, references: VID[], offset: Vec, rotation: Vec, inverted: boolean, name?: string) => ID;
801
840
  /**
802
841
  * Creates a new work plane for the given part
803
842
  * @param partId id of the part to add the new work plane to
@@ -810,6 +849,7 @@ export declare type ApiHistory = {
810
849
  * @param local if true, work plane is set in local coordinates of part???
811
850
  * @param name name of the work plane, if not set default name = 'WorkAxis'
812
851
  * @example // tbd
852
+ * @return id of the work plane
813
853
  */
814
854
  createWorkPlane: (partId: VID, type: WorkPlaneType, references: VID[], offset: number, angle: number, position: Vec, normal: Vec, local: boolean, name?: string) => ID;
815
855
  /**
@@ -822,10 +862,11 @@ export declare type ApiHistory = {
822
862
  * @param local if true, work point is set in local coordinates of part???
823
863
  * @param name name of the work point, if not set default name = 'WorkPoint'
824
864
  * @example // tbd
865
+ * @return id of the work point
825
866
  */
826
867
  createWorkPoint: (partId: VID, type: WorkPointType, references: VID[], position: Vec, local: boolean, name?: string) => ID;
827
868
  /**
828
- * Deletes an existing expression.
869
+ * Deletes existing expressions.
829
870
  * @param partId id or identifier of part to delete expressions from
830
871
  * @param members name of members to delete
831
872
  * @example
@@ -836,6 +877,7 @@ export declare type ApiHistory = {
836
877
  * await api.box(part, [], 'ExpressionSet.width', 20, 20)
837
878
  * const geoms = await api.createBufferGeometry(part)
838
879
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
880
+ * @return true or false, depending on whether deleting the expressions was successful or not
839
881
  */
840
882
  deleteExpressions: (partId: VID | ObjectIdent, members: string[]) => Promise<boolean>;
841
883
  /**
@@ -846,6 +888,7 @@ export declare type ApiHistory = {
846
888
  * @param strm stream of ofb file which contains the sketch
847
889
  * @param planeId id of the face or workplane to set the new sketch on
848
890
  * @param name optional name of the sketch to load from filestream
891
+ * @return id of the new sketch, containing the sketch elements from loaded sketch
849
892
  */
850
893
  loadSketch: (partId: VID, strm: ArrayBuffer, planeId: VID, name?: string) => ID;
851
894
  /**
@@ -855,6 +898,7 @@ export declare type ApiHistory = {
855
898
  * @param partId id of the part we want to create the new sketch and copy the sketch elements into it
856
899
  * @param sketchId id of the sketch to copy
857
900
  * @param planeId id of the face or workplane to set the new sketch on
901
+ * @return id of the new sketch, containing the sketch elements form copied sketch
858
902
  */
859
903
  copySketch: (partId: VID, sketchId: VID, planeId: VID) => ID;
860
904
  /**
@@ -871,8 +915,8 @@ export declare type ApiHistory = {
871
915
  */
872
916
  placeSketch: (sketchId: VID, planeId: VID, invertPlane: boolean, axisId: VID, isXAxis: boolean, invertAxis: boolean, originId: VID) => Promise<void>;
873
917
  /**
874
- * Creates a simple sphere entity.
875
- * @param partId id of the part where the cone will be created
918
+ * Creates a sphere operation
919
+ * @param partId id of the part where the sphere will be created
876
920
  * @param references reference of work coordinate system to place the cone at
877
921
  * @param radius bottom diameter of the cone
878
922
  * @example
@@ -881,10 +925,11 @@ export declare type ApiHistory = {
881
925
  * api.sphere(part, [], 20)
882
926
  * const geoms = await api.createBufferGeometry(part)
883
927
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
928
+ * @return id of the sphere operation
884
929
  */
885
930
  sphere: (partId: VID, references: VID[], radius: number | string) => ID;
886
931
  /**
887
- * Creates a fillet at the given edge references.
932
+ * Creates a fillet operation
888
933
  * @param partId id of the part where the fillet will be created
889
934
  * @param references edge references where the fillet will be created on
890
935
  * @param radius radius of the fillet
@@ -896,51 +941,75 @@ export declare type ApiHistory = {
896
941
  * api.fillet(part, topEdges, 2)
897
942
  * const geoms = await api.createBufferGeometry(part)
898
943
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
944
+ * @return id of the fillet operation
899
945
  */
900
946
  fillet: (partId: VID, references: VIDs, radius: number | string) => ID;
901
947
  /**
902
- * Find geometry (vertices, edges, faces, loops) by given positions or selection. If positions parameter is null,
903
- * user can select geometry in graphical interface. For all selected geometries this function logs its
904
- * relevant points into console, to find the geometry later by points
905
- * @param partId id of the part looking for geometry in or selecting them
906
- * @param type type of geometry to find or select
907
- * @param length number of selections to make before resolving the selection
908
- * @param positions array of point arrays where to look for geometry or null if the geometry wants to be selected
948
+ * Important note: To use this method, you need to add the BuerliGeometry component to your application.
949
+ * Otherwise the selection of geometry won't work.
950
+ * [See this link to buerli geometry](https://buerli.io/docs/training-for-programmers/More/graphics#3-using-the-buerligeometry-react-component)
951
+ *
952
+ * Lets the user select geometry in graphical interface. As soon as the geometry of given type has been selected, the method
953
+ * will return necessary information about it.
954
+ * [See this link to selections](https://buerli.io/docs/training-for-programmers/history/HowTos/useSelectionInHeadless)
955
+ *
956
+ * The _userData_ of the returned object contains additional information about the selected geometry. All geometric
957
+ * information in the _userData_ is already transformed to the correct position. This is especially important for
958
+ * assemblies.
959
+ *
960
+ * @param types array of types to filter user selection.
961
+ * @param count optional number of selections to make (count must be >= 1). Default = 1.
962
+ * @return array of objects containing information about selected geometries
909
963
  */
910
- findOrSelect: (partId: VID, type: BrepElemType, length: number, positions: Vec[][] | null) => IDs;
964
+ selectGeometry: <T = AnyGeometryElement>(types: GrT[], count?: number) => Promise<InteractionInfo<T>[]>;
911
965
  /**
912
- * Returns the assembly with given name from assembly container.
966
+ * Find geometries of given type on solids in the given part at the given global positions.
967
+ * @param partId Id of the part where geometries tried to be found.
968
+ * @param type Type of the geometry to look for
969
+ * @param positions Array of elements containing one or more positions to look for the geometry
970
+ * @example
971
+ * // Find planes at two different positions
972
+ * const planes = await api.findGeometry(productId, GraphicType.PLANE, [[{x: 50, y: 50, z: 100}], [{x: 100, y: 50, z: 50}]])
973
+ * @return array containing ids of found geometries
974
+ */
975
+ findGeometry: (partId: VID, type: GrT, positions: Vec[][]) => IDs;
976
+ /**
977
+ * Returns the assembly template with given name from assembly container.
913
978
  * If asmName is empty, all assemblies from assembly container will be returned.
914
979
  * @param asmName Name of assembly to look for
915
980
  * @example // tbd
981
+ * @return array containing ids of assembly templates
916
982
  */
917
- getAssemblyFromContainer: (asmName?: string) => IDs;
983
+ getAssemblyTemplate: (asmName?: string) => IDs;
918
984
  /**
919
- * Returns the direct node with given name of given reference with specified name.
920
- * If nodeName is empty, all nodes of given reference will be returned.
921
- * @param refId Reference of the assembly to look for the node
922
- * @param nodeName Name of the node to look for
985
+ * Returns an instance or all instances of a node, depending on whether a name is given or not.
986
+ * The node is the parent of the instance/instances we're looking for and can be a root assembly,
987
+ * another instance or an assembly template.
988
+ * @param id id of the node from which we are searching the children for instances that have the name we are looking for.
989
+ * @param instanceName name of the instance we are looking for
923
990
  * @example // tbd
991
+ * @return array containing the ids of the found instances
924
992
  */
925
- getAssemblyNode: (refId: VID, nodeName?: string) => IDs;
993
+ getInstance: (id: VID, instanceName?: string) => IDs;
926
994
  /**
927
- * Returns the products (array of product ids) of the given nodes (refIds).
928
- * @param refIds ids of the nodes (product references) to get the product (part or assembly) from
995
+ * Returns the product ids of the given instance ids.
996
+ * @param instanceIds ids of the instances to get the product ids from
929
997
  * @example // tbd
998
+ * @return array containing the product ids of the given instance ids
930
999
  */
931
- getProductOfNode: (refIds: VID[]) => IDs;
1000
+ getProductsOfInstances: (instanceIds: VID[]) => IDs;
932
1001
  /**
933
1002
  * Returns the id of the current product
934
1003
  * @example // tbd
935
1004
  */
936
1005
  getCurrentProduct: () => ID;
937
1006
  /**
938
- * Sets the node with refId to the new current node
1007
+ * Sets the instance with id to the new current instance
939
1008
  *
940
- * @param refId Reference id of the node to set as the current
1009
+ * @param id id of the instance to set as the current
941
1010
  * @example // tbd
942
1011
  */
943
- setCurrentNode: (refId: VID) => Promise<void>;
1012
+ setCurrentInstance: (id: VID) => Promise<void>;
944
1013
  /**
945
1014
  * Sets the product with productId to the new current product
946
1015
  *
@@ -949,30 +1018,38 @@ export declare type ApiHistory = {
949
1018
  */
950
1019
  setCurrentProduct: (productId: VID) => Promise<void>;
951
1020
  /**
952
- * Returns the id of the current node
1021
+ * Returns the id of the current instance
953
1022
  * @example // tbd
1023
+ * @return id of the current instance
954
1024
  */
955
- getCurrentNode: () => ID;
1025
+ getCurrentInstance: () => ID;
956
1026
  /**
957
- * Returns the coordinate system of the node with the
958
- * given refId. Where the node is an instance in the expanded tree of any product template
1027
+ * Returns the global transformation of the given id.
1028
+ * Currently only ids of instances supported.
959
1029
  *
960
- * @param refId Reference id of the node to get the coordinate system from
1030
+ * @param id id of the object to get the global transformation from
961
1031
  * @example // tbd
1032
+ * @return transformation of instance as two-dimensional array containing origin position and direction for x, y and z
1033
+ * [
1034
+ * [origin.x, origin.y, origin.z],
1035
+ * [xVec.x, xVec.y, xVec.z],
1036
+ * [yVec.x, yVec.y, yVec.z],
1037
+ * [zVec.x, zVec.y, zVec.z]
1038
+ * ]
962
1039
  */
963
- getCoordSysFromNode: (refId: VID) => Promise<number[][]>;
1040
+ getTransformation: (id: VID) => Promise<number[][]>;
964
1041
  /**
965
- * Returns the part with given name from part container.
1042
+ * Returns the part template with given name from part container.
966
1043
  * If partName is empty, all parts from part container will be returned.
967
1044
  * @param partName Name of part to look for
968
1045
  * @example // tbd
1046
+ * @return array containing ids of part templates
969
1047
  */
970
- getPartFromContainer: (partName?: string) => IDs;
1048
+ getPartTemplate: (partName?: string) => IDs;
971
1049
  /**
972
- * @deprecated use getWorkGeometry() instead, getWorkCoordSystem() will be removed in a future release.
973
- *
974
1050
  * Returns the work coord system with the given wcsName from the given reference.
975
1051
  * If wcsName is not set, all work coord systems of the reference will be returned.
1052
+ * @deprecated use getWorkGeometry() instead, getWorkCoordSystem() will be removed in a future release.
976
1053
  * @param refId id of the reference to look for the work coord system
977
1054
  * @param wcsName name of the work coord system to look for
978
1055
  * @example
@@ -983,37 +1060,39 @@ export declare type ApiHistory = {
983
1060
  * const yDir = { x: 0, y: 1, z: 0 }
984
1061
  * const nutBoltAsm = await api.createRootAssembly('NutBolt_Asm')
985
1062
  * const bolt = await api.loadProduct(arraybuffer, 'ofb')
986
- * const boltRefId = await api.addNode(bolt, nutBoltAsm, [pt0, xDir, yDir])
1063
+ * const boltRefId = await api.addInstances(bolt, nutBoltAsm, [pt0, xDir, yDir])
987
1064
  * const wcsIdOrigin = await api.getWorkCoordSystem(boltRefId, 'WCS_Origin')
988
1065
  * await api.createFastenedOriginConstraint(nutBoltAsm, { refId: boltRefId, wcsId: wcsIdOrigin[0] }, 0, 0, 0, 0, 0, 'FOC')
989
1066
  * const geoms = await api.createBufferGeometry(nutBoltAsm)
990
1067
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
1068
+ * @return array containing ids of work coordinate systems
991
1069
  */
992
- getWorkCoordSystem: (refId: VID, wcsName?: string) => IDs;
1070
+ getWorkCoordSystem: (id: VID, wcsName?: string) => IDs;
993
1071
  /**
994
- * Returns the sketch region with the given sketchRegionName from the given reference.
1072
+ * Returns the sketch region with the given sketchRegionName from the given instance or part id.
995
1073
  * If sketchRegionName is not set, all sketch regions of the reference will be returned.
996
- * @param refId id of the reference to look for the sketch region
1074
+ * @param id id of the instance or part to look for the sketch region
997
1075
  * @param wcsName name of the sketch region to look for
998
1076
  * @example // tbd
1077
+ * @return array containing ids of the sketch regions
999
1078
  */
1000
- getSketchRegion: (refId: VID, sketchRegionName?: string) => IDs;
1079
+ getSketchRegion: (id: VID, sketchRegionName?: string) => IDs;
1001
1080
  /**
1002
- * Returns the work geometry of given type with given name. If the name of the work geometry is empty,
1003
- * all found work geometry of given type is returned
1004
- * @param refId id of the reference to look for the work geometry
1081
+ * Returns the work geometry of given type with given name from the given instance or part id.
1082
+ * If the name of the work geometry is empty, all found work geometry of given type is returned
1083
+ * @param id id of the instance or part to look for the work geometry
1005
1084
  * @param type type of the work geometry to look for
1006
1085
  * @param wgName optional name of the work geometry to look for
1086
+ * @return array containing ids of the work geometry
1007
1087
  */
1008
- getWorkGeometry: (refId: VID, type: WorkGeomType, wgName?: string) => IDs;
1088
+ getWorkGeometry: (id: VID, type: WorkGeomType, wgName?: string) => IDs;
1009
1089
  /**
1010
- * @deprecated use specific methods e.g. getFastenedConstraint() instead, getConstraint() will be removed in a future release.
1011
- *
1012
1090
  * Returns information about a constraint in the given reference
1091
+ * @deprecated use specific methods e.g. getFastenedConstraint() instead, getConstraint() will be removed in a future release.
1013
1092
  * @param refId id of the reference to look for the constraint
1014
1093
  * @param constrName name of the constraint to look for
1015
1094
  * @example // tbd
1016
- * @returns
1095
+ * @return array containing information about the constraint
1017
1096
  * [
1018
1097
  * constraintId,
1019
1098
  * [ reference id of first mate, workcoordsystem id of first mate, flip type of first mate, reoriented type of first mate ],
@@ -1025,79 +1104,81 @@ export declare type ApiHistory = {
1025
1104
  */
1026
1105
  getConstraint: (refId: VID, constrName?: string) => Promise<ConstraintType>;
1027
1106
  /**
1028
- * Returns the fastened constraint of given reference with specified name.
1029
- * @param refId id of the reference to look for the constraint
1107
+ * Returns the fastened constraint of given instance or assembly id with specified name.
1108
+ * @param id id of the instance or assembly to look for the constraint
1030
1109
  * @param constrName name of the constraint to look for
1031
1110
  * @example // tbd
1032
- * @returns found fastened constraint as object.
1111
+ * @return found fastened constraint as object.
1033
1112
  */
1034
- getFastenedConstraint: (refId: VID, constrName: string) => Promise<FastenedConstraintType>;
1113
+ getFastenedConstraint: (id: VID, constrName: string) => Promise<FastenedConstraintType>;
1035
1114
  /**
1036
- * Returns the fastened origin constraint of given reference with specified name.
1037
- * @param refId id of the reference to look for the constraint
1115
+ * Returns the fastened origin constraint of given instance or assembly with specified name.
1116
+ * @param id id of the instance or assembly to look for the constraint
1038
1117
  * @param constrName name of the constraint to look for
1039
1118
  * @example // tbd
1040
- * @returns found fastened origin constraint as object.
1119
+ * @return found fastened origin constraint as object.
1041
1120
  */
1042
- getFastenedOriginConstraint: (refId: VID, constrName: string) => Promise<FastenedOriginConstraintType>;
1121
+ getFastenedOriginConstraint: (id: VID, constrName: string) => Promise<FastenedOriginConstraintType>;
1043
1122
  /**
1044
- * Returns the revolute constraint of given reference with specified name.
1045
- * @param refId id of the reference to look for the constraint
1123
+ * Returns the revolute constraint of given instance or assembly with specified name.
1124
+ * @param id id of the instance or assembly to look for the constraint
1046
1125
  * @param constrName name of the constraint to look for
1047
1126
  * @example // tbd
1048
- * @returns found revolute constraint as object.
1127
+ * @return found revolute constraint as object.
1049
1128
  */
1050
- getRevoluteConstraint: (refId: VID, constrName: string) => Promise<RevoluteConstraintType>;
1129
+ getRevoluteConstraint: (id: VID, constrName: string) => Promise<RevoluteConstraintType>;
1051
1130
  /**
1052
- * Returns the slider constraint of given reference with specified name.
1053
- * @param refId id of the reference to look for the constraint
1131
+ * Returns the slider constraint of given instance or assembly with specified name.
1132
+ * @param id id of the instance or assembly to look for the constraint
1054
1133
  * @param constrName name of the constraint to look for
1055
1134
  * @example // tbd
1056
- * @returns found slider constraint as object.
1135
+ * @return found slider constraint as object.
1057
1136
  */
1058
- getSliderConstraint: (refId: VID, constrName: string) => Promise<SliderConstraintType>;
1137
+ getSliderConstraint: (id: VID, constrName: string) => Promise<SliderConstraintType>;
1059
1138
  /**
1060
- * Returns the planar constraint of given reference with specified name.
1061
- * @param refId id of the reference to look for the constraint
1139
+ * Returns the planar constraint of given instance or assembly with specified name.
1140
+ * @param id id of the instance or assembly to look for the constraint
1062
1141
  * @param constrName name of the constraint to look for
1063
1142
  * @example // tbd
1064
- * @returns found planar constraint as object.
1143
+ * @return found planar constraint as object.
1065
1144
  */
1066
- getPlanarConstraint: (refId: VID, constrName: string) => Promise<PlanarConstraintType>;
1145
+ getPlanarConstraint: (id: VID, constrName: string) => Promise<PlanarConstraintType>;
1067
1146
  /**
1068
- * Returns the parallel constraint of given reference with specified name.
1069
- * @param refId id of the reference to look for the constraint
1147
+ * Returns the parallel constraint of given instance or assembly with specified name.
1148
+ * @param id id of the instance or assembly to look for the constraint
1070
1149
  * @param constrName name of the constraint to look for
1071
1150
  * @example // tbd
1072
- * @returns found parallel constraint as object.
1151
+ * @return found parallel constraint as object.
1073
1152
  */
1074
- getParallelConstraint: (refId: VID, constrName: string) => Promise<ParallelConstraintType>;
1153
+ getParallelConstraint: (id: VID, constrName: string) => Promise<ParallelConstraintType>;
1075
1154
  /**
1076
- * Returns the cylindrical constraint of given reference with specified name.
1077
- * @param refId id of the reference to look for the constraint
1155
+ * Returns the cylindrical constraint of given instance or assembly with specified name.
1156
+ * @param id id of the instance or assembly to look for the constraint
1078
1157
  * @param constrName name of the constraint to look for
1079
1158
  * @example // tbd
1080
- * @returns found cylindrical constraint as object.
1159
+ * @return found cylindrical constraint as object.
1081
1160
  */
1082
- getCylindricalConstraint: (refId: VID, constrName: string) => Promise<CylindricalConstraintType>;
1161
+ getCylindricalConstraint: (id: VID, constrName: string) => Promise<CylindricalConstraintType>;
1083
1162
  /**
1084
- * Returns the id of the feature with name = featureName. The feature can then
1163
+ * Returns the id of the feature / operation with name = featureName. The feature can then
1085
1164
  * be used for further operations, like boolean, transformations and so on.
1086
- * @param partId id of the part where to look for the feature
1165
+ * @param partId id of the part where to look for the feature / operation
1087
1166
  * @param featureName name of the feature to look for
1088
1167
  * @example // tbd
1168
+ * @return id of the feature / operation
1089
1169
  */
1090
1170
  getFeatureByName: (partId: VID, featureName: string) => ID;
1091
1171
  /**
1092
1172
  * Returns an object containing the center of gravity and the volume of the given
1093
- * product, node or solid. Depending on the input parameter the calculations were made
1173
+ * product, instance or solid. Depending on the input parameter the calculations were made
1094
1174
  * on a single solid, a part, a subassembly, the whole model, ... E.g. the center of gravity of
1095
1175
  * a root assembly, will be the sum of all solid's center of gravity over the whole assembly structure
1096
1176
  *
1097
- * @param objectId id of the part, assembly, node or solid we want the information from
1177
+ * @param id id of the part, assembly, instance or solid we want the information from
1098
1178
  * @example // tbd
1179
+ * @return object containing the geometry information
1099
1180
  */
1100
- getGeometryInformation: (objectId: VID) => Promise<ModelInfo | null>;
1181
+ getGeometryInformation: (id: VID) => Promise<ModelInfo | null>;
1101
1182
  /**
1102
1183
  * Writes the current drawing to a stream and returns the data.
1103
1184
  *
@@ -1107,95 +1188,112 @@ export declare type ApiHistory = {
1107
1188
  *
1108
1189
  * @param type type to write
1109
1190
  * @example // tbd
1191
+ * @return stream data
1110
1192
  */
1111
1193
  save: (type: 'ofb' | 'stp') => Promise<Uint8Array | null>;
1112
1194
  /**
1113
- * POSTs the result to the given url.
1195
+ * Writes the current drawing to a stream and POSTs the result to the given url.
1114
1196
  * @param url The url to POST the model to.
1115
1197
  * @param filetype The file type be saved (ofb, stp).
1116
1198
  * @example // tbd
1199
+ * @return true if saving was successful
1117
1200
  */
1118
1201
  saveToUrl: (url: string, filetype: 'ofb' | 'stp') => Promise<boolean>;
1119
1202
  /**
1120
1203
  * Loads the given buffer.
1121
1204
  * @param content data as arraybuffer
1122
1205
  * @param type type of the data to load
1206
+ * @param options optional object containing ident property to define an identifier for the loaded root product
1123
1207
  * @example // tbd
1208
+ * @return array containing the id of the loaded product in the file
1124
1209
  */
1125
- load: (content: ArrayBuffer, type: 'ofb' | 'stp') => Promise<number[] | null>;
1210
+ load: (content: ArrayBuffer, type: 'ofb' | 'stp', options?: {
1211
+ ident?: ObjectIdent;
1212
+ }) => Promise<number[] | null>;
1126
1213
  /**
1127
1214
  * Loads from the given url.
1128
1215
  * @param url The url to load data from.
1129
1216
  * @param filetype The type of data delivered by the url (ofb, stp).
1217
+ * @param options optional object containing ident property to define an identifier for the loaded root product
1130
1218
  * @example // tbd
1219
+ * @return array containing the id of the loaded product from url
1131
1220
  */
1132
- loadFromUrl: (url: string, filetype: 'ofb' | 'stp') => Promise<number[] | null>;
1221
+ loadFromUrl: (url: string, filetype: 'ofb' | 'stp', options?: {
1222
+ ident?: ObjectIdent;
1223
+ }) => Promise<number[] | null>;
1133
1224
  /**
1134
- * Loads a product into the current drawing.
1225
+ * Loads a product into the current drawing and adds it to the part- or assembly container.
1135
1226
  * @param content data as arraybuffer
1136
1227
  * @param type type of the data to load
1137
- * @param options optional object containing ident property, to define a identifier for the loaded product
1228
+ * @param options optional object containing ident property to define an identifier for the loaded product
1138
1229
  * @example
1139
1230
  * // Loads an existing product
1140
1231
  * const part = api.loadProduct(arraybuffer, 'ofb')
1141
1232
  * const geoms = await api.createBufferGeometry(part)
1142
1233
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
1234
+ * @return array containing the id of the loaded products
1143
1235
  */
1144
1236
  loadProduct: (content: ArrayBuffer, type: 'ofb' | 'stp', options?: {
1145
1237
  ident?: ObjectIdent;
1146
1238
  }) => Promise<number[] | null>;
1147
1239
  /**
1148
- * Loads a product from the given URL into the current drawing.
1240
+ * Loads a product from the given URL into the current drawing and adds it to the part- or assembly container.
1149
1241
  * @param url The url to load data from.
1150
1242
  * @param filetype The type of data delivered by the url ('ofb', 'stp').
1151
1243
  * @param options optional object containing ident property, to define a identifier for the loaded product
1152
1244
  * @example // tbd
1245
+ * @return array containing the id of the loaded products
1153
1246
  */
1154
1247
  loadProductFromUrl: (url: string, filetype: 'ofb' | 'stp', options?: {
1155
1248
  ident?: ObjectIdent;
1156
1249
  }) => Promise<number[] | null>;
1157
1250
  /**
1158
- * Creates a new feature and appends geometry to it. This method can be used to import specific geometry
1251
+ * Creates a import feature operation and appends geometry to it. This method can be used to import specific geometry
1159
1252
  * which can be used for further operations like boolean, translations and so on.
1160
1253
  * @param partId id of the part where to add the new feature
1161
1254
  * @param content data buffer to add to the import feature
1162
1255
  * @param format the content format
1163
1256
  * @param name optional name for the feature, default = 'Import'
1164
1257
  * @example // tbd
1258
+ * @return id of the import feature operation
1165
1259
  */
1166
1260
  importFeature: (partId: VID, content: ArrayBuffer, format: 'stp' | 'step', name?: string) => ID;
1167
1261
  /**
1168
- * Removes multiple nodes from an assembly node at once
1169
- * @param nodes array of node parameter objects. See following descriptions.
1170
- * @param referenceId id or identifier of the node to remove
1262
+ * Removes instances from root assembly, other instances or assembly templates.
1263
+ * @param instances array of instance objects. See following parameter descriptions.
1264
+ * @param id id or identifier of the instance to remove
1171
1265
  * @example // tbd
1172
1266
  */
1173
- removeNodes: (...nodes: {
1174
- referenceId: VID | ObjectIdent;
1267
+ removeInstances: (...instances: {
1268
+ id: VID | ObjectIdent;
1175
1269
  }[]) => Promise<void>;
1176
1270
  /**
1177
- * Transforms the node with referenceId with the given transformation within an assembly
1178
- *
1179
- * @param referenceId id of the node to transform
1180
- * @param ownerId id of the owner (parent) of node we want to transform
1181
- * @param transformation array of three vectors [origin, xAxis, yAxis]
1271
+ * Transforms instances by the given transformation.
1272
+ * The transformations are local to the instances parent, which is an assembly.
1273
+ * @param instances array of instance objects. See following descriptions.
1274
+ * @param id id or identifier of the instance to transform
1275
+ * @param transformation transformation (origin, xDir, yDir) of the instance local to the owner.
1182
1276
  * @example // tbd
1183
1277
  */
1184
- transformNode: (referenceId: VID, ownerId: VID, transformation: Transform) => Promise<void>;
1278
+ transformInstances: (...instances: {
1279
+ id: VID | ObjectIdent;
1280
+ transformation: Transform;
1281
+ }[]) => Promise<void>;
1185
1282
  /**
1186
- * Translates a feature along a given axis.
1283
+ * Creates a translate operation
1187
1284
  * @param partId id ot the part where features will be translated
1188
- * @param featureIds ids of the features which will be translated
1285
+ * @param operations ids of the operations which are used for this translate operation,
1286
+ * e.g. box, extrusion, chamfer operation
1189
1287
  * @param references references which define the direction of translation. E.g workaxis, 2 workpoints,..
1190
1288
  * @param inverted flag if direction is inverted or not
1191
1289
  * @param distance distance of translation
1192
1290
  * @example // tbd
1291
+ * @return id of the translate operation
1193
1292
  */
1194
- translate: (partId: VID, featureIds: VID[], references: VID[], inverted: 0 | 1, distance: number | string) => ID;
1293
+ translate: (partId: VID, operations: VID[], references: VID[], inverted: 0 | 1, distance: number | string) => ID;
1195
1294
  /**
1196
- * @deprecated use translate() instead, updateTranslate() will be removed in a future release.
1197
- *
1198
1295
  * Updates a already created translation. To update value will be distance of translation
1296
+ * @deprecated use translate() instead, updateTranslate() will be removed in a future release.
1199
1297
  * @param translationId id of the translation (feature id) which will be updated
1200
1298
  * @param distance new value for distance
1201
1299
  * @example // tbd
@@ -1203,7 +1301,8 @@ export declare type ApiHistory = {
1203
1301
  updateTranslate: (translationId: VID, distance: number) => Promise<void>;
1204
1302
  /**
1205
1303
  * Returns found vertices, edges or faces depending on
1206
- * given type an points. Given points define where to look for elements.
1304
+ * given type and points. Given points define where to look for elements.
1305
+ * @deprecated use findGeometry() instead, pick() will be removed in a future release.
1207
1306
  * @param partId id of the part to pick elements
1208
1307
  * @param type type of element to pick
1209
1308
  * @param points points containing 3D coordinates to look for possible element
@@ -1215,11 +1314,11 @@ export declare type ApiHistory = {
1215
1314
  * api.fillet(part, edges, 2)
1216
1315
  * const geoms = await api.createBufferGeometry(part)
1217
1316
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
1317
+ * @return array containing ids of found geometries
1218
1318
  */
1219
1319
  pick: (partId: VID, type: 'vertex' | 'edge' | 'face', points: Vec[]) => IDs;
1220
1320
  /**
1221
1321
  * Updates multiple expressions in different parts at once
1222
- *
1223
1322
  * @param expressions array of expression objects containing the part id and the expression to set
1224
1323
  * @param partId id or identifier of part to update expression
1225
1324
  * @param members array of members to update which contain a name and a value. Value can be an expression, e.g. '2 * laenge'
@@ -1234,30 +1333,54 @@ export declare type ApiHistory = {
1234
1333
  }[];
1235
1334
  }[]) => Promise<boolean>;
1236
1335
  /**
1237
- * Mirrors the entities of a feature at the position of the plane reference
1336
+ * Creates a mirror operation.
1337
+ * Mirrors the entities of an operation at the position of the plane reference
1238
1338
  * @param partId id of the part where the mirror will be created
1239
- * @param entities id of the feature/operation we want to use entities from
1339
+ * @param operations ids of the operations which are used for this mirror operation,
1340
+ * e.g. box, extrusion, chamfer operation
1240
1341
  * @param references id of the references which will be used to mirror (e.g. Workplane)
1241
1342
  */
1242
- mirror: (partId: VID, entities: VID[], references: VID[]) => Promise<ObjectID | null>;
1343
+ mirror: (partId: VID, operations: VID[], references: VID[]) => Promise<ObjectID | null>;
1243
1344
  /**
1244
1345
  * Removes the given operations or the operations which are added after 'toOperation' in history, depending
1245
1346
  * on whether operations or toOperation parameter is given.
1246
1347
  * @param operations ids of all to remove operations. First element in the array will be removed first.
1247
- * This means operations which depend on eacht other, need to be removed from newest to oldest.
1348
+ * This means operations which depend on each other, need to be removed from newest to oldest.
1248
1349
  * @param toOperation all operations, from rollback bar until the id of this operation, will be deleted
1249
1350
  */
1250
1351
  removeOperations: (operations: VID[], toOperation: VID) => Promise<void>;
1251
1352
  /**
1252
- * Creates and returns the mate path as array from the given reference id up to the current node.
1253
- * This helps to get the right path to set constraints between nodes which are located in
1254
- * subassemblies.
1255
- * @param refId id of the node to set the constraint on
1256
- */
1257
- getMatePath: (refId: VID) => Promise<ObjectID[]>;
1353
+ * Creates and returns the mate path as array from the given instance id up to the current instance.
1354
+ * This helps to get the right path to set constraints between instances which are located in
1355
+ * nested assemblies.
1356
+ * @param instanceId id of the instance to get the mate path from
1357
+ * @return array containing the ids as a path from given instance to current instance
1358
+ */
1359
+ getMatePath: (instanceId: VID) => Promise<ObjectID[]>;
1360
+ /**
1361
+ * Creates a slice operation.
1362
+ * Slices the entities of the given operations by the given reference.
1363
+ * @param partId id of the part where the slice will be created
1364
+ * @param operations ids of the operations which are used for this slice operation,
1365
+ * e.g. box, extrusion, chamfer operation
1366
+ * @param reference id of the workplane reference to use for the slice
1367
+ * @param sideFlag flag to toggle which side of the slice will be kept
1368
+ * @return id of the slice operation
1369
+ */
1370
+ slice: (partId: VID, operations: VID[], reference: VID, sideFlag: boolean) => ID;
1371
+ /**
1372
+ * Creates a slice by sheet operation.
1373
+ * Slices the entity of an operation with a sheet entity of another operation
1374
+ * @param partId id of the part where the slice will be created
1375
+ * @param operationToSlice id of the operation which will be sliced in this slice by sheet operation
1376
+ * @param operationOfSheet id of the operation which is used as the slice
1377
+ * @param sideFlag flag to toggle which side of the slice will be kept
1378
+ * @return id of the slice by sheet operation
1379
+ */
1380
+ sliceBySheet: (partId: VID, operationToSlice: VID, operationOfSheet: VID, sideFlag: boolean) => ID;
1258
1381
  };
1259
1382
  export default class CAD {
1260
- private drawingId;
1383
+ drawingId: DrawingID | null;
1261
1384
  queue: Promise<number>;
1262
1385
  constructor();
1263
1386
  resolve(callback: (...results: any) => Promise<any>, ...args: any[]): Promise<any>;
@@ -1283,89 +1406,159 @@ declare type MateParam = {
1283
1406
  flip: FlipType;
1284
1407
  reoriented: ReorientedType;
1285
1408
  };
1409
+ declare type GrT = GraphicType.POINT | GraphicType.LINE | GraphicType.ARC | GraphicType.CIRCLE | GraphicType.PLANE | GraphicType.CYLINDER | GraphicType.CONE | GraphicType.SPHERE | GraphicType.NURBSCURVE | GraphicType.NURBSSURFACE;
1410
+ /**
1411
+ * Array type containing three points of type Point = {x: number, y: number, z: number}.
1412
+ * - [0] = origin position containing x-, y- and z-coordinates
1413
+ * - [1] = x-direction vector
1414
+ * - [2] = y-direction vector
1415
+ */
1286
1416
  export declare type Transform = [Point, Point, Point];
1287
1417
  export declare type DimensionType = {
1418
+ /** id of the product to create the 2d dimension in */
1288
1419
  productId: VID;
1420
+ /** object containing specific parameters for the dimension */
1289
1421
  dimParam: {
1422
+ /** type of the dimension, currently linear and radial dimensions can be created */
1290
1423
  dimType: 'LinearDimension';
1424
+ /** optional name for the dimension */
1291
1425
  dimName?: string;
1426
+ /** optional label for the dimension, this will appear in the 2d view next to the dimension. E.g. "Width = " */
1292
1427
  dimLabel: string;
1428
+ /** optional value for the label, if empty the value will calculated automatically */
1293
1429
  dimValue?: number | null;
1430
+ /** start position of the dimension */
1294
1431
  dimStartPos: Vec;
1432
+ /** end position of the dimension */
1295
1433
  dimEndPos: Vec;
1434
+ /** position of the dimension text (combination of label and value) */
1296
1435
  dimTextPos: Vec;
1436
+ /** text orientation from x-axis counter clockwise, angle in radians */
1297
1437
  dimTextAngle: number;
1438
+ /** orientation of dimension, e.g. HORIZONTAL = (along x-axis) or VERTICAL = (along y-axis) */
1298
1439
  dimOrientation: OrientationType;
1440
+ /** color of the dimension (autocad color index), 256 = color will be taken from layer */
1299
1441
  dimColor?: number;
1442
+ /** layer where the dimension will appear, e.g. "2", depends on layer definitions in dxf template */
1300
1443
  dimLayer?: string;
1301
1444
  };
1445
+ /** type of the view e.g. top, front, iso, ... where the dimension will be visible in the dxf file */
1302
1446
  dxfView: ViewType;
1303
1447
  };
1304
1448
  export declare type ViewOptionsType = {
1449
+ /** optional color (autocad color index) to set for the 2d view, if color = 256 then color will be taken from layer definition */
1305
1450
  color?: number;
1451
+ /** optional layer to set for the 2d view, layers are defined in the dxf file */
1306
1452
  layer?: string;
1307
1453
  };
1308
1454
  export declare type FastenedOriginConstraintType = {
1455
+ /** id of the constraint */
1309
1456
  constrId: VID;
1457
+ /** first mate constraint */
1310
1458
  mate1: MateParam;
1459
+ /** offset in x-direction */
1311
1460
  xOffset: number | string;
1461
+ /** offset in y-direction */
1312
1462
  yOffset: number | string;
1463
+ /** offset in z-direction */
1313
1464
  zOffset: number | string;
1314
1465
  };
1315
1466
  export declare type FastenedConstraintType = {
1467
+ /** id of the constraint */
1316
1468
  constrId: VID;
1469
+ /** first mate constraint */
1317
1470
  mate1: MateParam;
1471
+ /** second mate constraint */
1318
1472
  mate2: MateParam;
1473
+ /** offset in x-direction */
1319
1474
  xOffset: number | string;
1475
+ /** offset in y-direction */
1320
1476
  yOffset: number | string;
1477
+ /** offset in z-direction */
1321
1478
  zOffset: number | string;
1322
1479
  };
1323
1480
  export declare type RevoluteConstraintType = {
1481
+ /** id of the constraint */
1324
1482
  constrId: VID;
1483
+ /** first mate constraint */
1325
1484
  mate1: MateParam;
1485
+ /** second mate constraint */
1326
1486
  mate2: MateParam;
1487
+ /** offset in z-direction */
1327
1488
  zOffset: number | string;
1489
+ /** min and max limit for the rotation around z-Axis */
1328
1490
  zRotationLimits: LimitsParam;
1329
1491
  };
1330
1492
  export declare type SliderConstraintType = {
1493
+ /** id of the constraint */
1331
1494
  constrId: VID;
1495
+ /** first mate constraint */
1332
1496
  mate1: MateParam;
1497
+ /** second mate constraint */
1333
1498
  mate2: MateParam;
1499
+ /** offset in x-direction */
1334
1500
  xOffset: number | string;
1501
+ /** offset in y-direction */
1335
1502
  yOffset: number | string;
1503
+ /** min and max limit for the z-offset */
1336
1504
  zOffsetLimits: LimitsParam;
1337
1505
  };
1338
1506
  export declare type PlanarConstraintType = {
1507
+ /** id of the constraint */
1339
1508
  constrId: VID;
1509
+ /** first mate constraint */
1340
1510
  mate1: MateParam;
1511
+ /** second mate constraint */
1341
1512
  mate2: MateParam;
1513
+ /** offset in z-direction */
1342
1514
  zOffset: number | string;
1515
+ /** min and max limit for the x-offset */
1343
1516
  xOffsetLimits: LimitsParam;
1517
+ /** min and max limit for the y-offset */
1344
1518
  yOffsetLimits: LimitsParam;
1519
+ /** min and max limit for the rotation around z-Axis */
1345
1520
  zRotationLimits: LimitsParam;
1346
1521
  };
1347
1522
  export declare type ParallelConstraintType = {
1523
+ /** id of the constraint */
1348
1524
  constrId: VID;
1525
+ /** first mate constraint */
1349
1526
  mate1: MateParam;
1527
+ /** second mate constraint */
1350
1528
  mate2: MateParam;
1529
+ /** min and max limit for the x-offset */
1351
1530
  xOffsetLimits: LimitsParam;
1531
+ /** min and max limit for the y-offset */
1352
1532
  yOffsetLimits: LimitsParam;
1533
+ /** min and max limit for the z-offset */
1353
1534
  zOffsetLimits: LimitsParam;
1535
+ /** min and max limit for the rotation around z-Axis */
1354
1536
  zRotationLimits: LimitsParam;
1355
1537
  };
1356
1538
  export declare type CylindricalConstraintType = {
1539
+ /** id of the constraint */
1357
1540
  constrId: VID;
1541
+ /** first mate constraint */
1358
1542
  mate1: MateParam;
1543
+ /** second mate constraint */
1359
1544
  mate2: MateParam;
1545
+ /** min and max limit for the z-offset */
1360
1546
  zOffsetLimits: LimitsParam;
1547
+ /** min and max limit for the rotation around z-Axis */
1361
1548
  zRotationLimits: LimitsParam;
1362
1549
  };
1363
1550
  /**
1364
1551
  * Information about constraint.
1365
1552
  * [
1366
1553
  * constraintId,
1367
- * [ path to product reference, workcoordsystem id of first mate, flip type of first mate, reoriented type of first mate ],
1368
- * [ path to product reference, workcoordsystem id of second mate, flip type of second mate, reoriented type of second mate ],
1554
+ * [ path to product reference,
1555
+ * workcoordsystem id of 1st mate,
1556
+ * flip type of 1st mate,
1557
+ * reoriented type of 1st mate ],
1558
+ * [ path to product reference,
1559
+ * workcoordsystem id of 2nd mate,
1560
+ * flip type of 2nd mate,
1561
+ * reoriented type of 2nd mate ],
1369
1562
  * xOffset,
1370
1563
  * yOffset,
1371
1564
  * zOffset
@@ -1389,4 +1582,12 @@ export declare type ConstraintType = [
1389
1582
  number,
1390
1583
  number
1391
1584
  ];
1585
+ /**
1586
+ * General vector type representing following types:
1587
+ * - number[]
1588
+ * - PointMemValue = {x: number, y: number, z: number}
1589
+ * - THREE.Vector [See threejs documentation](https://threejs.org/docs/?q=Vect#api/en/math/Vector3)
1590
+ * - THREE.Euler [See threejs documentation](https://threejs.org/docs/?q=Euler#api/en/math/Euler)
1591
+ */
1592
+ export declare type Vec = number[] | PointMemValue | THREE.Vector3 | THREE.Euler;
1392
1593
  export {};