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