@buerli.io/headless 0.6.1-beta.0 → 0.7.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,3 +10,17 @@ Usage information and reference details can be found in the [buerli documentatio
10
10
  npm install @buerli.io/headless
11
11
  yarn add @buerli.io/headless
12
12
  ```
13
+
14
+ ### Usage
15
+
16
+ ```jsx
17
+ import { history } from '@buerli.io/headless'
18
+ import { init, SocketIOClient } from '@buerli.io/classcad'
19
+
20
+ init(id => return new SocketIOClient('ws://localhost:9091', id))
21
+ const history = new history()
22
+ instance.init(api => {
23
+ const part = await api.createPart('Part')
24
+ // ...
25
+ })
26
+ ```
@@ -50,6 +50,12 @@ let BufferGeometryUtils = BufferGeometryUtils_;
50
50
  if (BufferGeometryUtils.BufferGeometryUtils) {
51
51
  BufferGeometryUtils = BufferGeometryUtils.BufferGeometryUtils;
52
52
  }
53
+ const resolveVec = (value) => {
54
+ if (Array.isArray(value))
55
+ return { x: value[0], y: value[1], z: value[2] };
56
+ else
57
+ return value;
58
+ };
53
59
  /**
54
60
  * Returns the cclass of the given dimension type
55
61
  * @param type type of the dimension as string
@@ -132,7 +138,7 @@ const createRecursiveScene = async (object, drawingId, root, result, options) =>
132
138
  const entities = object.link ? tree[object.link].solids : object.solids;
133
139
  if (entities != undefined) {
134
140
  const part = new three_1.Group();
135
- part.matrix = core_1.MathUtils.convertToMatrix4(object.coordinateSystem);
141
+ part.matrix = object.coordinateSystem ? core_1.MathUtils.convertToMatrix4(object.coordinateSystem) : new three_1.Matrix4();
136
142
  part.matrixAutoUpdate = false;
137
143
  part.userData = { id: object.id }; // product reference id
138
144
  part.name = object.name; // product reference name
@@ -192,7 +198,7 @@ const createRecursiveScene = async (object, drawingId, root, result, options) =>
192
198
  else if (object.children) {
193
199
  // Assembly
194
200
  const assembly = new three_1.Group();
195
- assembly.matrix = core_1.MathUtils.convertToMatrix4(object.coordinateSystem);
201
+ assembly.matrix = object.coordinateSystem ? core_1.MathUtils.convertToMatrix4(object.coordinateSystem) : new three_1.Matrix4();
196
202
  assembly.matrixAutoUpdate = false;
197
203
  assembly.userData = { id: object.id }; // assembly root or product reference id
198
204
  assembly.name = object.name; // assembly root or product reference name
@@ -216,9 +222,10 @@ const logPoints = (points) => {
216
222
  if (points && points.length > 0) {
217
223
  for (let i = 0; i < points.length; i++) {
218
224
  for (let j = 0; j < points[i].length; j++) {
219
- const x = Math.round(points[i][j].x * 1000) / 1000;
220
- const y = Math.round(points[i][j].y * 1000) / 1000;
221
- const z = Math.round(points[i][j].z * 1000) / 1000;
225
+ const point = resolveVec(points[i][j]);
226
+ const x = Math.round(point.x * 1000) / 1000;
227
+ const y = Math.round(point.y * 1000) / 1000;
228
+ const z = Math.round(point.z * 1000) / 1000;
222
229
  log += '{ x: ' + x + ', y: ' + y + ', z: ' + z + '}';
223
230
  log += points[i].length - 1 === j ? '' : ',';
224
231
  }
@@ -288,9 +295,9 @@ class CAD {
288
295
  name: dim.dimParam.dimName,
289
296
  label: dim.dimParam.dimLabel,
290
297
  value: dim.dimParam.dimValue,
291
- startPos: dim.dimParam.dimStartPos,
292
- endPos: dim.dimParam.dimEndPos,
293
- textPos: dim.dimParam.dimTextPos,
298
+ startPos: resolveVec(dim.dimParam.dimStartPos),
299
+ endPos: resolveVec(dim.dimParam.dimEndPos),
300
+ textPos: resolveVec(dim.dimParam.dimTextPos),
294
301
  textAngle: dim.dimParam.dimTextAngle,
295
302
  orientation: dim.dimParam.dimOrientation,
296
303
  color: dim.dimParam.dimColor,
@@ -328,7 +335,10 @@ class CAD {
328
335
  },
329
336
  place2DViews: (productId, viewPositions) => {
330
337
  return this.resolve(async ([rProductId]) => {
331
- return drawing2DAPI.place2DViews(drawingId, rProductId, viewPositions);
338
+ return drawing2DAPI.place2DViews(drawingId, rProductId, viewPositions.map(({ viewType, vector }) => ({
339
+ viewType,
340
+ vector: resolveVec(vector),
341
+ })));
332
342
  }, productId);
333
343
  },
334
344
  exportDXF: (productId, dxfTemplateFilename) => {
@@ -449,7 +459,7 @@ class CAD {
449
459
  isExpr: typeof taperAngle === 'string',
450
460
  };
451
461
  const directionParam = {
452
- value: direction,
462
+ value: resolveVec(direction),
453
463
  isExpr: typeof direction === 'string',
454
464
  };
455
465
  await featureAPI.updateExtrusion(drawingId, extrusion, sketchLines, type, limit1Param, limit2Param, taperAngleParam, directionParam, capEnds);
@@ -1119,11 +1129,11 @@ class CAD {
1119
1129
  const wAId = await featureAPI.createWorkGeometry(drawingId, rPartId, classcad_1.CCClasses.CCWorkAxis, wAName);
1120
1130
  if (wAId != null) {
1121
1131
  const positionParam = {
1122
- value: position,
1132
+ value: resolveVec(position),
1123
1133
  isExpr: typeof position === 'string',
1124
1134
  };
1125
1135
  const directionParam = {
1126
- value: direction,
1136
+ value: resolveVec(direction),
1127
1137
  isExpr: typeof direction === 'string',
1128
1138
  };
1129
1139
  await featureAPI.updateWorkAxis(drawingId, wAId, type, rReferences, positionParam, directionParam, local);
@@ -1132,17 +1142,20 @@ class CAD {
1132
1142
  return null;
1133
1143
  }, partId, ...references);
1134
1144
  },
1135
- createWorkCoordSystem: (partId, type, references, coordinateSystem, offset, rotation, inverted, local, name) => {
1145
+ createWorkCoordSystem: (partId, type, references, coordinateSystem, offset, rotation, inverted = false, local = false, name) => {
1136
1146
  return this.resolve(async ([rPartId, ...rReferences]) => {
1137
1147
  const wCSName = name ? name : 'WorkCoordSystem';
1138
1148
  const wCSId = await featureAPI.createWorkGeometry(drawingId, rPartId, classcad_1.CCClasses.CCWorkCoordSystem, wCSName);
1139
1149
  if (wCSId != null) {
1140
- const offsetParam = { value: offset, isExpr: typeof offset === 'string' };
1150
+ const offsetParam = {
1151
+ value: resolveVec(offset),
1152
+ isExpr: typeof offset === 'string',
1153
+ };
1141
1154
  const rotationParam = {
1142
- value: rotation,
1155
+ value: resolveVec(rotation),
1143
1156
  isExpr: typeof rotation === 'string',
1144
1157
  };
1145
- await featureAPI.updateWorkCoordSystem(drawingId, wCSId, type, rReferences, coordinateSystem, offsetParam, rotationParam, inverted, local);
1158
+ await featureAPI.updateWorkCoordSystem(drawingId, wCSId, type, rReferences, coordinateSystem.map(resolveVec), offsetParam, rotationParam, inverted ? 1 : 0, local);
1146
1159
  return wCSId;
1147
1160
  }
1148
1161
  return null;
@@ -1156,10 +1169,13 @@ class CAD {
1156
1169
  const offsetParam = { value: offset, isExpr: typeof offset === 'string' };
1157
1170
  const angleParam = { value: angle, isExpr: typeof angle === 'string' };
1158
1171
  const positionParam = {
1159
- value: position,
1172
+ value: resolveVec(position),
1160
1173
  isExpr: typeof position === 'string',
1161
1174
  };
1162
- const normalParam = { value: normal, isExpr: typeof normal === 'string' };
1175
+ const normalParam = {
1176
+ value: resolveVec(normal),
1177
+ isExpr: typeof normal === 'string',
1178
+ };
1163
1179
  await featureAPI.updateWorkPlane(drawingId, wPId, type, rReferences, offsetParam, angleParam, positionParam, normalParam, local);
1164
1180
  return wPId;
1165
1181
  }
@@ -1172,7 +1188,7 @@ class CAD {
1172
1188
  const wPTId = await featureAPI.createWorkGeometry(drawingId, rPartId, classcad_1.CCClasses.CCWorkPoint, wPTName);
1173
1189
  if (wPTId != undefined) {
1174
1190
  const positionParam = {
1175
- value: position,
1191
+ value: resolveVec(position),
1176
1192
  isExpr: typeof position === 'string',
1177
1193
  };
1178
1194
  await featureAPI.updateWorkPoint(drawingId, wPTId, type, rReferences, positionParam, local);
@@ -1210,7 +1226,7 @@ class CAD {
1210
1226
  break;
1211
1227
  }
1212
1228
  const geometries = positions
1213
- ? await geometryAPI.findGeometriesByPoints(drawingId, rPartId, type, positions)
1229
+ ? await geometryAPI.findGeometriesByPoints(drawingId, rPartId, type, positions.map(p => p.map(resolveVec)))
1214
1230
  : await (0, selection_1.waitForSelect)(length, filter, (resolveSelection, items, diff) => {
1215
1231
  if (items.length > length - 1) {
1216
1232
  resolveSelection(items.map(i => i.data.graphicId));
@@ -1452,14 +1468,14 @@ class CAD {
1452
1468
  return null;
1453
1469
  }, partId);
1454
1470
  },
1455
- getGeometryInformation: (productOrSolidId) => {
1471
+ getGeometryInformation: (objectId) => {
1456
1472
  return this.resolve(async ([rProductOrSolidId]) => {
1457
1473
  const values = await baseModelerAPI.getGeometryInformation(drawingId, rProductOrSolidId);
1458
1474
  if (values !== null) {
1459
1475
  return { centerOfGravity: values[0], volume: values[1] };
1460
1476
  }
1461
1477
  return null;
1462
- }, productOrSolidId);
1478
+ }, objectId);
1463
1479
  },
1464
1480
  removeNodes: (...nodes) => {
1465
1481
  return this.resolve(async ([...rNodes]) => {
@@ -1581,7 +1597,7 @@ class CAD {
1581
1597
  },
1582
1598
  pick: (partId, type, points) => {
1583
1599
  return this.resolve(async ([rPartId]) => {
1584
- const refs = await featureAPI.pick(drawingId, rPartId, type, points);
1600
+ const refs = await featureAPI.pick(drawingId, rPartId, type, points.map(resolveVec));
1585
1601
  if (refs != undefined) {
1586
1602
  return Array.isArray(refs) ? refs : [refs];
1587
1603
  }
@@ -8,7 +8,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
8
8
  /* eslint-disable max-lines */
9
9
  import { ccAPI, CCClasses, ccUtils, DataType, SVGModusType, } from '@buerli.io/classcad';
10
10
  import { api, getDrawing, lineSegmentsFilter, loopFilter, MathUtils, planeFilter, pointFilter, } from '@buerli.io/core';
11
- import { Group, Mesh, MeshStandardMaterial, Scene } from 'three';
11
+ import { Group, Matrix4, Mesh, MeshStandardMaterial, Scene } from 'three';
12
12
  import * as BufferGeometryUtils_ from 'three/examples/jsm/utils/BufferGeometryUtils';
13
13
  import { waitForSelect } from './utils/selection';
14
14
  import { getDifferentColoredMeshesFromEntity } from './utils/meshes';
@@ -25,6 +25,12 @@ let BufferGeometryUtils = BufferGeometryUtils_;
25
25
  if (BufferGeometryUtils.BufferGeometryUtils) {
26
26
  BufferGeometryUtils = BufferGeometryUtils.BufferGeometryUtils;
27
27
  }
28
+ const resolveVec = (value) => {
29
+ if (Array.isArray(value))
30
+ return { x: value[0], y: value[1], z: value[2] };
31
+ else
32
+ return value;
33
+ };
28
34
  /**
29
35
  * Returns the cclass of the given dimension type
30
36
  * @param type type of the dimension as string
@@ -107,7 +113,7 @@ const createRecursiveScene = async (object, drawingId, root, result, options) =>
107
113
  const entities = object.link ? tree[object.link].solids : object.solids;
108
114
  if (entities != undefined) {
109
115
  const part = new Group();
110
- part.matrix = MathUtils.convertToMatrix4(object.coordinateSystem);
116
+ part.matrix = object.coordinateSystem ? MathUtils.convertToMatrix4(object.coordinateSystem) : new Matrix4();
111
117
  part.matrixAutoUpdate = false;
112
118
  part.userData = { id: object.id }; // product reference id
113
119
  part.name = object.name; // product reference name
@@ -167,7 +173,7 @@ const createRecursiveScene = async (object, drawingId, root, result, options) =>
167
173
  else if (object.children) {
168
174
  // Assembly
169
175
  const assembly = new Group();
170
- assembly.matrix = MathUtils.convertToMatrix4(object.coordinateSystem);
176
+ assembly.matrix = object.coordinateSystem ? MathUtils.convertToMatrix4(object.coordinateSystem) : new Matrix4();
171
177
  assembly.matrixAutoUpdate = false;
172
178
  assembly.userData = { id: object.id }; // assembly root or product reference id
173
179
  assembly.name = object.name; // assembly root or product reference name
@@ -191,9 +197,10 @@ const logPoints = (points) => {
191
197
  if (points && points.length > 0) {
192
198
  for (let i = 0; i < points.length; i++) {
193
199
  for (let j = 0; j < points[i].length; j++) {
194
- const x = Math.round(points[i][j].x * 1000) / 1000;
195
- const y = Math.round(points[i][j].y * 1000) / 1000;
196
- const z = Math.round(points[i][j].z * 1000) / 1000;
200
+ const point = resolveVec(points[i][j]);
201
+ const x = Math.round(point.x * 1000) / 1000;
202
+ const y = Math.round(point.y * 1000) / 1000;
203
+ const z = Math.round(point.z * 1000) / 1000;
197
204
  log += '{ x: ' + x + ', y: ' + y + ', z: ' + z + '}';
198
205
  log += points[i].length - 1 === j ? '' : ',';
199
206
  }
@@ -263,9 +270,9 @@ export default class CAD {
263
270
  name: dim.dimParam.dimName,
264
271
  label: dim.dimParam.dimLabel,
265
272
  value: dim.dimParam.dimValue,
266
- startPos: dim.dimParam.dimStartPos,
267
- endPos: dim.dimParam.dimEndPos,
268
- textPos: dim.dimParam.dimTextPos,
273
+ startPos: resolveVec(dim.dimParam.dimStartPos),
274
+ endPos: resolveVec(dim.dimParam.dimEndPos),
275
+ textPos: resolveVec(dim.dimParam.dimTextPos),
269
276
  textAngle: dim.dimParam.dimTextAngle,
270
277
  orientation: dim.dimParam.dimOrientation,
271
278
  color: dim.dimParam.dimColor,
@@ -303,7 +310,10 @@ export default class CAD {
303
310
  },
304
311
  place2DViews: (productId, viewPositions) => {
305
312
  return this.resolve(async ([rProductId]) => {
306
- return drawing2DAPI.place2DViews(drawingId, rProductId, viewPositions);
313
+ return drawing2DAPI.place2DViews(drawingId, rProductId, viewPositions.map(({ viewType, vector }) => ({
314
+ viewType,
315
+ vector: resolveVec(vector),
316
+ })));
307
317
  }, productId);
308
318
  },
309
319
  exportDXF: (productId, dxfTemplateFilename) => {
@@ -424,7 +434,7 @@ export default class CAD {
424
434
  isExpr: typeof taperAngle === 'string',
425
435
  };
426
436
  const directionParam = {
427
- value: direction,
437
+ value: resolveVec(direction),
428
438
  isExpr: typeof direction === 'string',
429
439
  };
430
440
  await featureAPI.updateExtrusion(drawingId, extrusion, sketchLines, type, limit1Param, limit2Param, taperAngleParam, directionParam, capEnds);
@@ -1094,11 +1104,11 @@ export default class CAD {
1094
1104
  const wAId = await featureAPI.createWorkGeometry(drawingId, rPartId, CCClasses.CCWorkAxis, wAName);
1095
1105
  if (wAId != null) {
1096
1106
  const positionParam = {
1097
- value: position,
1107
+ value: resolveVec(position),
1098
1108
  isExpr: typeof position === 'string',
1099
1109
  };
1100
1110
  const directionParam = {
1101
- value: direction,
1111
+ value: resolveVec(direction),
1102
1112
  isExpr: typeof direction === 'string',
1103
1113
  };
1104
1114
  await featureAPI.updateWorkAxis(drawingId, wAId, type, rReferences, positionParam, directionParam, local);
@@ -1107,17 +1117,20 @@ export default class CAD {
1107
1117
  return null;
1108
1118
  }, partId, ...references);
1109
1119
  },
1110
- createWorkCoordSystem: (partId, type, references, coordinateSystem, offset, rotation, inverted, local, name) => {
1120
+ createWorkCoordSystem: (partId, type, references, coordinateSystem, offset, rotation, inverted = false, local = false, name) => {
1111
1121
  return this.resolve(async ([rPartId, ...rReferences]) => {
1112
1122
  const wCSName = name ? name : 'WorkCoordSystem';
1113
1123
  const wCSId = await featureAPI.createWorkGeometry(drawingId, rPartId, CCClasses.CCWorkCoordSystem, wCSName);
1114
1124
  if (wCSId != null) {
1115
- const offsetParam = { value: offset, isExpr: typeof offset === 'string' };
1125
+ const offsetParam = {
1126
+ value: resolveVec(offset),
1127
+ isExpr: typeof offset === 'string',
1128
+ };
1116
1129
  const rotationParam = {
1117
- value: rotation,
1130
+ value: resolveVec(rotation),
1118
1131
  isExpr: typeof rotation === 'string',
1119
1132
  };
1120
- await featureAPI.updateWorkCoordSystem(drawingId, wCSId, type, rReferences, coordinateSystem, offsetParam, rotationParam, inverted, local);
1133
+ await featureAPI.updateWorkCoordSystem(drawingId, wCSId, type, rReferences, coordinateSystem.map(resolveVec), offsetParam, rotationParam, inverted ? 1 : 0, local);
1121
1134
  return wCSId;
1122
1135
  }
1123
1136
  return null;
@@ -1131,10 +1144,13 @@ export default class CAD {
1131
1144
  const offsetParam = { value: offset, isExpr: typeof offset === 'string' };
1132
1145
  const angleParam = { value: angle, isExpr: typeof angle === 'string' };
1133
1146
  const positionParam = {
1134
- value: position,
1147
+ value: resolveVec(position),
1135
1148
  isExpr: typeof position === 'string',
1136
1149
  };
1137
- const normalParam = { value: normal, isExpr: typeof normal === 'string' };
1150
+ const normalParam = {
1151
+ value: resolveVec(normal),
1152
+ isExpr: typeof normal === 'string',
1153
+ };
1138
1154
  await featureAPI.updateWorkPlane(drawingId, wPId, type, rReferences, offsetParam, angleParam, positionParam, normalParam, local);
1139
1155
  return wPId;
1140
1156
  }
@@ -1147,7 +1163,7 @@ export default class CAD {
1147
1163
  const wPTId = await featureAPI.createWorkGeometry(drawingId, rPartId, CCClasses.CCWorkPoint, wPTName);
1148
1164
  if (wPTId != undefined) {
1149
1165
  const positionParam = {
1150
- value: position,
1166
+ value: resolveVec(position),
1151
1167
  isExpr: typeof position === 'string',
1152
1168
  };
1153
1169
  await featureAPI.updateWorkPoint(drawingId, wPTId, type, rReferences, positionParam, local);
@@ -1185,7 +1201,7 @@ export default class CAD {
1185
1201
  break;
1186
1202
  }
1187
1203
  const geometries = positions
1188
- ? await geometryAPI.findGeometriesByPoints(drawingId, rPartId, type, positions)
1204
+ ? await geometryAPI.findGeometriesByPoints(drawingId, rPartId, type, positions.map(p => p.map(resolveVec)))
1189
1205
  : await waitForSelect(length, filter, (resolveSelection, items, diff) => {
1190
1206
  if (items.length > length - 1) {
1191
1207
  resolveSelection(items.map(i => i.data.graphicId));
@@ -1427,14 +1443,14 @@ export default class CAD {
1427
1443
  return null;
1428
1444
  }, partId);
1429
1445
  },
1430
- getGeometryInformation: (productOrSolidId) => {
1446
+ getGeometryInformation: (objectId) => {
1431
1447
  return this.resolve(async ([rProductOrSolidId]) => {
1432
1448
  const values = await baseModelerAPI.getGeometryInformation(drawingId, rProductOrSolidId);
1433
1449
  if (values !== null) {
1434
1450
  return { centerOfGravity: values[0], volume: values[1] };
1435
1451
  }
1436
1452
  return null;
1437
- }, productOrSolidId);
1453
+ }, objectId);
1438
1454
  },
1439
1455
  removeNodes: (...nodes) => {
1440
1456
  return this.resolve(async ([...rNodes]) => {
@@ -1556,7 +1572,7 @@ export default class CAD {
1556
1572
  },
1557
1573
  pick: (partId, type, points) => {
1558
1574
  return this.resolve(async ([rPartId]) => {
1559
- const refs = await featureAPI.pick(drawingId, rPartId, type, points);
1575
+ const refs = await featureAPI.pick(drawingId, rPartId, type, points.map(resolveVec));
1560
1576
  if (refs != undefined) {
1561
1577
  return Array.isArray(refs) ? refs : [refs];
1562
1578
  }
@@ -1,6 +1,7 @@
1
1
  import { BooleanOperationType, ChamferType, FlipType, ReorientedType, WorkAxisType, WorkCoordSystemType, WorkPlaneType, WorkPointType, ViewType, OrientationType, ExtrusionType, BrepElemType, WorkGeomType, SVGModusType, LimitsParam, LimitedValue } from '@buerli.io/classcad';
2
2
  import { ObjectIdent, ObjectID, PointMemValue } from '@buerli.io/core';
3
3
  import { BufferGeometry, Group, Mesh, Scene } from 'three';
4
+ export declare type Vec = number[] | PointMemValue | THREE.Vector3 | THREE.Euler;
4
5
  /**
5
6
  * History based modeling is similar to solid modeling, but it is non-destructive and
6
7
  * parametric. You can move back and forth in the modeling history and create feature
@@ -90,9 +91,9 @@ export declare type ApiHistory = {
90
91
  dimName?: string;
91
92
  dimLabel: string;
92
93
  dimValue?: number | null;
93
- dimStartPos: PointMemValue;
94
- dimEndPos: PointMemValue;
95
- dimTextPos: PointMemValue;
94
+ dimStartPos: Vec;
95
+ dimEndPos: Vec;
96
+ dimTextPos: Vec;
96
97
  dimTextAngle: number;
97
98
  dimOrientation: OrientationType;
98
99
  dimColor?: number;
@@ -127,7 +128,7 @@ export declare type ApiHistory = {
127
128
  * // Returns for each view a min and max point
128
129
  * console.info(bbs) // [[{x: -105, y: -89, z: 0}, {x: 105, y: 55, z: 0}], [...], [...]]
129
130
  */
130
- getBoundaryBoxFromViews: (productId: VID, viewTypes?: ViewType[]) => Promise<[PointMemValue, PointMemValue][]>;
131
+ getBoundaryBoxFromViews: (productId: VID, viewTypes?: ViewType[]) => Promise<[Vec, Vec][]>;
131
132
  /**
132
133
  * Place the 2D views relatively to the origin.
133
134
  * @param productId id of the product where the views will be placed in
@@ -141,7 +142,7 @@ export declare type ApiHistory = {
141
142
  */
142
143
  place2DViews: (productId: VID, viewPositions: {
143
144
  viewType: ViewType;
144
- vector: PointMemValue;
145
+ vector: Vec;
145
146
  }[]) => Promise<void>;
146
147
  /**
147
148
  * Export the placed views as dxf file.
@@ -225,7 +226,7 @@ export declare type ApiHistory = {
225
226
  * @param direction Direction of extrusion
226
227
  * @param capEnds If true, ends will be capped, else a sheet will be created
227
228
  */
228
- extrusion: (partId: VID, sketchOrRegionIds: VID | VIDs, type: ExtrusionType, limit1: number | string, limit2: number | string, taperAngle: number | string, direction: PointMemValue, capEnds: 0 | 1) => ID;
229
+ extrusion: (partId: VID, sketchOrRegionIds: VID | VIDs, type: ExtrusionType, limit1: number | string, limit2: number | string, taperAngle: number | string, direction: Vec, capEnds: 0 | 1) => ID;
229
230
  /**
230
231
  * Creates a revolve
231
232
  * @param partId Id of the part to create the revolve in.
@@ -748,7 +749,7 @@ export declare type ApiHistory = {
748
749
  * @param name name of the work axis, if not set default name = 'WorkAxis'
749
750
  * @example //tbd
750
751
  */
751
- createWorkAxis: (partId: VID, type: WorkAxisType, references: VID[], position: PointMemValue, direction: PointMemValue, local: boolean, name?: string) => ID;
752
+ createWorkAxis: (partId: VID, type: WorkAxisType, references: VID[], position: Vec, direction: Vec, local: boolean, name?: string) => ID;
752
753
  /**
753
754
  * Creates a new work coordinate system for the given part.
754
755
  * @param partId id of the part to add the new work coord system to
@@ -792,7 +793,7 @@ export declare type ApiHistory = {
792
793
  * const geoms = await api.createBufferGeometry(rootAsm)
793
794
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
794
795
  */
795
- createWorkCoordSystem: (partId: VID, type: WorkCoordSystemType, references: VID[], coordinateSystem: PointMemValue[], offset: PointMemValue, rotation: PointMemValue, inverted: 0 | 1, local: boolean, name?: string) => ID;
796
+ createWorkCoordSystem: (partId: VID, type: WorkCoordSystemType, references: VID[], coordinateSystem: Vec[], offset: Vec, rotation: Vec, inverted: boolean, local: boolean, name?: string) => ID;
796
797
  /**
797
798
  * Creates a new work plane for the given part
798
799
  * @param partId id of the part to add the new work plane to
@@ -806,7 +807,7 @@ export declare type ApiHistory = {
806
807
  * @param name name of the work plane, if not set default name = 'WorkAxis'
807
808
  * @example // tbd
808
809
  */
809
- createWorkPlane: (partId: VID, type: WorkPlaneType, references: VID[], offset: number, angle: number, position: PointMemValue, normal: PointMemValue, local: boolean, name?: string) => ID;
810
+ createWorkPlane: (partId: VID, type: WorkPlaneType, references: VID[], offset: number, angle: number, position: Vec, normal: Vec, local: boolean, name?: string) => ID;
810
811
  /**
811
812
  * Creates a new work point for the given part
812
813
  * @param partId id of the part to add the new work point to
@@ -818,7 +819,7 @@ export declare type ApiHistory = {
818
819
  * @param name name of the work point, if not set default name = 'WorkPoint'
819
820
  * @example // tbd
820
821
  */
821
- createWorkPoint: (partId: VID, type: WorkPointType, references: VID[], position: PointMemValue, local: boolean, name?: string) => ID;
822
+ createWorkPoint: (partId: VID, type: WorkPointType, references: VID[], position: Vec, local: boolean, name?: string) => ID;
822
823
  /**
823
824
  * Deletes an existing expression.
824
825
  * @param partId id or identifier of part to delete expressions from
@@ -902,7 +903,7 @@ export declare type ApiHistory = {
902
903
  * @param length number of selections to make before resolving the selection
903
904
  * @param positions array of point arrays where to look for geometry or null if the geometry wants to be selected
904
905
  */
905
- findOrSelect: (partId: VID, type: BrepElemType, length: number, positions: PointMemValue[][] | null) => IDs;
906
+ findOrSelect: (partId: VID, type: BrepElemType, length: number, positions: Vec[][] | null) => IDs;
906
907
  /**
907
908
  * Returns the assembly with given name from assembly container.
908
909
  * If asmName is empty, all assemblies from assembly container will be returned.
@@ -1089,10 +1090,10 @@ export declare type ApiHistory = {
1089
1090
  * on a single solid, a part, a subassembly, the whole model, ... E.g. the center of gravity of
1090
1091
  * a root assembly, will be the sum of all solid's center of gravity over the whole assembly structure
1091
1092
  *
1092
- * @param productOrSolidId id of the product, node or solid to get the information from
1093
+ * @param objectId id of the part, assembly, node or solid we want the information from
1093
1094
  * @example // tbd
1094
1095
  */
1095
- getGeometryInformation: (productOrSolidId: VID) => Promise<ModelInfo | null>;
1096
+ getGeometryInformation: (objectId: VID) => Promise<ModelInfo | null>;
1096
1097
  /**
1097
1098
  * Writes the current drawing to a stream and returns the data.
1098
1099
  *
@@ -1211,7 +1212,7 @@ export declare type ApiHistory = {
1211
1212
  * const geoms = await api.createBufferGeometry(part)
1212
1213
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
1213
1214
  */
1214
- pick: (partId: VID, type: 'vertex' | 'edge' | 'face', points: PointMemValue[]) => IDs;
1215
+ pick: (partId: VID, type: 'vertex' | 'edge' | 'face', points: Vec[]) => IDs;
1215
1216
  /**
1216
1217
  * Updates multiple expressions in different parts at once
1217
1218
  *
@@ -1269,7 +1270,7 @@ declare type Point = {
1269
1270
  z: number;
1270
1271
  };
1271
1272
  declare type ModelInfo = {
1272
- centerOfGravity: PointMemValue;
1273
+ centerOfGravity: Vec;
1273
1274
  volume: number;
1274
1275
  };
1275
1276
  declare type MateParam = {
@@ -1286,9 +1287,9 @@ export declare type DimensionType = {
1286
1287
  dimName?: string;
1287
1288
  dimLabel: string;
1288
1289
  dimValue?: number | null;
1289
- dimStartPos: PointMemValue;
1290
- dimEndPos: PointMemValue;
1291
- dimTextPos: PointMemValue;
1290
+ dimStartPos: Vec;
1291
+ dimEndPos: Vec;
1292
+ dimTextPos: Vec;
1292
1293
  dimTextAngle: number;
1293
1294
  dimOrientation: OrientationType;
1294
1295
  dimColor?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/headless",
3
- "version": "0.6.1-beta.0",
3
+ "version": "0.7.1-beta.0",
4
4
  "description": "A non-manifold CAD workflow for the web",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "license": "ISC",
@@ -30,7 +30,7 @@
30
30
  "three": ">=0.138"
31
31
  },
32
32
  "dependencies": {
33
- "@buerli.io/classcad": "0.6.1-beta.0",
33
+ "@buerli.io/classcad": "0.7.1-beta.0",
34
34
  "flat-promise": "^1.0.3"
35
35
  }
36
36
  }