@buerli.io/headless 1.2.0 → 2.0.0-beta.20261016093142

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.
@@ -8,7 +8,6 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.history = exports.History = void 0;
11
- /* eslint-disable max-lines */
12
11
  const classcad_1 = require("@buerli.io/classcad");
13
12
  const core_1 = require("@buerli.io/core");
14
13
  const three_1 = require("three");
@@ -242,11 +241,13 @@ class History {
242
241
  getState: () => core_1.api.getState(),
243
242
  setFacetingParameters: (distanceTol, angleTol) => this.resolve(async () => cc.v0.common.setFacetingParameters(distanceTol, angleTol)),
244
243
  addInstances: async (...instances) => {
245
- var e_1, _a;
244
+ var _a, e_1, _b, _c;
246
245
  const instancesToAdd = [];
247
246
  try {
248
- for (var instances_1 = __asyncValues(instances), instances_1_1; instances_1_1 = await instances_1.next(), !instances_1_1.done;) {
249
- const instance = instances_1_1.value;
247
+ for (var _d = true, instances_1 = __asyncValues(instances), instances_1_1; instances_1_1 = await instances_1.next(), _a = instances_1_1.done, !_a; _d = true) {
248
+ _c = instances_1_1.value;
249
+ _d = false;
250
+ const instance = _c;
250
251
  const [rProductId, rOwnerId] = await new Promise(res => this.resolve(id => res(id), instance.productId, instance.ownerId));
251
252
  // Looking for the productId given by an identifier or name
252
253
  // Priorities:
@@ -300,18 +301,20 @@ class History {
300
301
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
301
302
  finally {
302
303
  try {
303
- if (instances_1_1 && !instances_1_1.done && (_a = instances_1.return)) await _a.call(instances_1);
304
+ if (!_d && !_a && (_b = instances_1.return)) await _b.call(instances_1);
304
305
  }
305
306
  finally { if (e_1) throw e_1.error; }
306
307
  }
307
308
  return assemblyBuilderAPI.addInstances(instancesToAdd);
308
309
  },
309
310
  addDimensions: async (...dimensions) => {
310
- var e_2, _a;
311
+ var _a, e_2, _b, _c;
311
312
  const dimParamsToAdd = [];
312
313
  try {
313
- for (var dimensions_1 = __asyncValues(dimensions), dimensions_1_1; dimensions_1_1 = await dimensions_1.next(), !dimensions_1_1.done;) {
314
- const dim = dimensions_1_1.value;
314
+ for (var _d = true, dimensions_1 = __asyncValues(dimensions), dimensions_1_1; dimensions_1_1 = await dimensions_1.next(), _a = dimensions_1_1.done, !_a; _d = true) {
315
+ _c = dimensions_1_1.value;
316
+ _d = false;
317
+ const dim = _c;
315
318
  const [rProductId] = await new Promise(res => this.resolve(id => res(id), dim.productId));
316
319
  switch (dim.param.type) {
317
320
  case classcad_1.CCClasses.CCLinearDimension:
@@ -338,7 +341,7 @@ class History {
338
341
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
339
342
  finally {
340
343
  try {
341
- if (dimensions_1_1 && !dimensions_1_1.done && (_a = dimensions_1.return)) await _a.call(dimensions_1);
344
+ if (!_d && !_a && (_b = dimensions_1.return)) await _b.call(dimensions_1);
342
345
  }
343
346
  finally { if (e_2) throw e_2.error; }
344
347
  }
@@ -613,11 +616,13 @@ class History {
613
616
  return null;
614
617
  },
615
618
  updateFastenedConstraints: async (...constraints) => {
616
- var e_3, _a;
619
+ var _a, e_3, _b, _c;
617
620
  const constrToAdd = [];
618
621
  try {
619
- for (var constraints_1 = __asyncValues(constraints), constraints_1_1; constraints_1_1 = await constraints_1.next(), !constraints_1_1.done;) {
620
- const constr = constraints_1_1.value;
622
+ for (var _d = true, constraints_1 = __asyncValues(constraints), constraints_1_1; constraints_1_1 = await constraints_1.next(), _a = constraints_1_1.done, !_a; _d = true) {
623
+ _c = constraints_1_1.value;
624
+ _d = false;
625
+ const constr = _c;
621
626
  const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
622
627
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
623
628
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
@@ -662,7 +667,7 @@ class History {
662
667
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
663
668
  finally {
664
669
  try {
665
- if (constraints_1_1 && !constraints_1_1.done && (_a = constraints_1.return)) await _a.call(constraints_1);
670
+ if (!_d && !_a && (_b = constraints_1.return)) await _b.call(constraints_1);
666
671
  }
667
672
  finally { if (e_3) throw e_3.error; }
668
673
  }
@@ -696,11 +701,13 @@ class History {
696
701
  return null;
697
702
  },
698
703
  updateFastenedOriginConstraints: async (...constraints) => {
699
- var e_4, _a;
704
+ var _a, e_4, _b, _c;
700
705
  const constraintsToAdd = [];
701
706
  try {
702
- for (var constraints_2 = __asyncValues(constraints), constraints_2_1; constraints_2_1 = await constraints_2.next(), !constraints_2_1.done;) {
703
- const constr = constraints_2_1.value;
707
+ for (var _d = true, constraints_2 = __asyncValues(constraints), constraints_2_1; constraints_2_1 = await constraints_2.next(), _a = constraints_2_1.done, !_a; _d = true) {
708
+ _c = constraints_2_1.value;
709
+ _d = false;
710
+ const constr = _c;
704
711
  const [rConstrId, rWcs1] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId));
705
712
  const rMatePath = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
706
713
  const xOffsetParam = { value: constr.xOffset, isExpr: typeof constr.xOffset === 'string' };
@@ -738,7 +745,7 @@ class History {
738
745
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
739
746
  finally {
740
747
  try {
741
- if (constraints_2_1 && !constraints_2_1.done && (_a = constraints_2.return)) await _a.call(constraints_2);
748
+ if (!_d && !_a && (_b = constraints_2.return)) await _b.call(constraints_2);
742
749
  }
743
750
  finally { if (e_4) throw e_4.error; }
744
751
  }
@@ -774,11 +781,13 @@ class History {
774
781
  return null;
775
782
  },
776
783
  updateCylindricalConstraints: async (...constraints) => {
777
- var e_5, _a;
784
+ var _a, e_5, _b, _c;
778
785
  const constrToAdd = [];
779
786
  try {
780
- for (var constraints_3 = __asyncValues(constraints), constraints_3_1; constraints_3_1 = await constraints_3.next(), !constraints_3_1.done;) {
781
- const constr = constraints_3_1.value;
787
+ for (var _d = true, constraints_3 = __asyncValues(constraints), constraints_3_1; constraints_3_1 = await constraints_3.next(), _a = constraints_3_1.done, !_a; _d = true) {
788
+ _c = constraints_3_1.value;
789
+ _d = false;
790
+ const constr = _c;
782
791
  const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
783
792
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
784
793
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
@@ -804,7 +813,7 @@ class History {
804
813
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
805
814
  finally {
806
815
  try {
807
- if (constraints_3_1 && !constraints_3_1.done && (_a = constraints_3.return)) await _a.call(constraints_3);
816
+ if (!_d && !_a && (_b = constraints_3.return)) await _b.call(constraints_3);
808
817
  }
809
818
  finally { if (e_5) throw e_5.error; }
810
819
  }
@@ -841,11 +850,13 @@ class History {
841
850
  return null;
842
851
  },
843
852
  updateRevoluteConstraints: async (...constraints) => {
844
- var e_6, _a;
853
+ var _a, e_6, _b, _c;
845
854
  const constrToAdd = [];
846
855
  try {
847
- for (var constraints_4 = __asyncValues(constraints), constraints_4_1; constraints_4_1 = await constraints_4.next(), !constraints_4_1.done;) {
848
- const constr = constraints_4_1.value;
856
+ for (var _d = true, constraints_4 = __asyncValues(constraints), constraints_4_1; constraints_4_1 = await constraints_4.next(), _a = constraints_4_1.done, !_a; _d = true) {
857
+ _c = constraints_4_1.value;
858
+ _d = false;
859
+ const constr = _c;
849
860
  const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
850
861
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
851
862
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
@@ -872,7 +883,7 @@ class History {
872
883
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
873
884
  finally {
874
885
  try {
875
- if (constraints_4_1 && !constraints_4_1.done && (_a = constraints_4.return)) await _a.call(constraints_4);
886
+ if (!_d && !_a && (_b = constraints_4.return)) await _b.call(constraints_4);
876
887
  }
877
888
  finally { if (e_6) throw e_6.error; }
878
889
  }
@@ -911,11 +922,13 @@ class History {
911
922
  return null;
912
923
  },
913
924
  updateSliderConstraints: async (...constraints) => {
914
- var e_7, _a;
925
+ var _a, e_7, _b, _c;
915
926
  const constrToAdd = [];
916
927
  try {
917
- for (var constraints_5 = __asyncValues(constraints), constraints_5_1; constraints_5_1 = await constraints_5.next(), !constraints_5_1.done;) {
918
- const constr = constraints_5_1.value;
928
+ for (var _d = true, constraints_5 = __asyncValues(constraints), constraints_5_1; constraints_5_1 = await constraints_5.next(), _a = constraints_5_1.done, !_a; _d = true) {
929
+ _c = constraints_5_1.value;
930
+ _d = false;
931
+ const constr = _c;
919
932
  const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
920
933
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
921
934
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
@@ -944,7 +957,7 @@ class History {
944
957
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
945
958
  finally {
946
959
  try {
947
- if (constraints_5_1 && !constraints_5_1.done && (_a = constraints_5.return)) await _a.call(constraints_5);
960
+ if (!_d && !_a && (_b = constraints_5.return)) await _b.call(constraints_5);
948
961
  }
949
962
  finally { if (e_7) throw e_7.error; }
950
963
  }
@@ -983,11 +996,13 @@ class History {
983
996
  return null;
984
997
  },
985
998
  updatePlanarConstraints: async (...constraints) => {
986
- var e_8, _a;
999
+ var _a, e_8, _b, _c;
987
1000
  const constrToAdd = [];
988
1001
  try {
989
- for (var constraints_6 = __asyncValues(constraints), constraints_6_1; constraints_6_1 = await constraints_6.next(), !constraints_6_1.done;) {
990
- const constr = constraints_6_1.value;
1002
+ for (var _d = true, constraints_6 = __asyncValues(constraints), constraints_6_1; constraints_6_1 = await constraints_6.next(), _a = constraints_6_1.done, !_a; _d = true) {
1003
+ _c = constraints_6_1.value;
1004
+ _d = false;
1005
+ const constr = _c;
991
1006
  const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
992
1007
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
993
1008
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
@@ -1016,7 +1031,7 @@ class History {
1016
1031
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
1017
1032
  finally {
1018
1033
  try {
1019
- if (constraints_6_1 && !constraints_6_1.done && (_a = constraints_6.return)) await _a.call(constraints_6);
1034
+ if (!_d && !_a && (_b = constraints_6.return)) await _b.call(constraints_6);
1020
1035
  }
1021
1036
  finally { if (e_8) throw e_8.error; }
1022
1037
  }
@@ -1054,11 +1069,13 @@ class History {
1054
1069
  return null;
1055
1070
  },
1056
1071
  updateParallelConstraints: async (...constraints) => {
1057
- var e_9, _a;
1072
+ var _a, e_9, _b, _c;
1058
1073
  const constrToAdd = [];
1059
1074
  try {
1060
- for (var constraints_7 = __asyncValues(constraints), constraints_7_1; constraints_7_1 = await constraints_7.next(), !constraints_7_1.done;) {
1061
- const constr = constraints_7_1.value;
1075
+ for (var _d = true, constraints_7 = __asyncValues(constraints), constraints_7_1; constraints_7_1 = await constraints_7.next(), _a = constraints_7_1.done, !_a; _d = true) {
1076
+ _c = constraints_7_1.value;
1077
+ _d = false;
1078
+ const constr = _c;
1062
1079
  const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
1063
1080
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
1064
1081
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
@@ -1086,7 +1103,7 @@ class History {
1086
1103
  catch (e_9_1) { e_9 = { error: e_9_1 }; }
1087
1104
  finally {
1088
1105
  try {
1089
- if (constraints_7_1 && !constraints_7_1.done && (_a = constraints_7.return)) await _a.call(constraints_7);
1106
+ if (!_d && !_a && (_b = constraints_7.return)) await _b.call(constraints_7);
1090
1107
  }
1091
1108
  finally { if (e_9) throw e_9.error; }
1092
1109
  }
@@ -1108,11 +1125,13 @@ class History {
1108
1125
  return null;
1109
1126
  },
1110
1127
  updateGroupConstraints: async (...constraints) => {
1111
- var e_10, _a;
1128
+ var _a, e_10, _b, _c;
1112
1129
  const constrToAdd = [];
1113
1130
  try {
1114
- for (var constraints_8 = __asyncValues(constraints), constraints_8_1; constraints_8_1 = await constraints_8.next(), !constraints_8_1.done;) {
1115
- const constr = constraints_8_1.value;
1131
+ for (var _d = true, constraints_8 = __asyncValues(constraints), constraints_8_1; constraints_8_1 = await constraints_8.next(), _a = constraints_8_1.done, !_a; _d = true) {
1132
+ _c = constraints_8_1.value;
1133
+ _d = false;
1134
+ const constr = _c;
1116
1135
  const [rConstrId] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId));
1117
1136
  const rInstanceIds = await new Promise(res => this.resolve(paths => res(paths), ...constr.instanceIds));
1118
1137
  constrToAdd.push({
@@ -1124,7 +1143,7 @@ class History {
1124
1143
  catch (e_10_1) { e_10 = { error: e_10_1 }; }
1125
1144
  finally {
1126
1145
  try {
1127
- if (constraints_8_1 && !constraints_8_1.done && (_a = constraints_8.return)) await _a.call(constraints_8);
1146
+ if (!_d && !_a && (_b = constraints_8.return)) await _b.call(constraints_8);
1128
1147
  }
1129
1148
  finally { if (e_10) throw e_10.error; }
1130
1149
  }
@@ -1188,11 +1207,13 @@ class History {
1188
1207
  return null;
1189
1208
  },
1190
1209
  updateLinearPatternConstraints: async (...constraints) => {
1191
- var e_11, _a;
1210
+ var _a, e_11, _b, _c;
1192
1211
  const constrToAdd = [];
1193
1212
  try {
1194
- for (var constraints_9 = __asyncValues(constraints), constraints_9_1; constraints_9_1 = await constraints_9.next(), !constraints_9_1.done;) {
1195
- const constr = constraints_9_1.value;
1213
+ for (var _d = true, constraints_9 = __asyncValues(constraints), constraints_9_1; constraints_9_1 = await constraints_9.next(), _a = constraints_9_1.done, !_a; _d = true) {
1214
+ _c = constraints_9_1.value;
1215
+ _d = false;
1216
+ const constr = _c;
1196
1217
  const [rConstrId, rInstanceId, rWcs1, rWcs2] = await new Promise(res => {
1197
1218
  var _a;
1198
1219
  return this.resolve(ids => res(ids), constr.constrId, constr.instanceId, constr.mate1.wcsId, (_a = constr.mate2) === null || _a === void 0 ? void 0 : _a.wcsId);
@@ -1249,7 +1270,7 @@ class History {
1249
1270
  catch (e_11_1) { e_11 = { error: e_11_1 }; }
1250
1271
  finally {
1251
1272
  try {
1252
- if (constraints_9_1 && !constraints_9_1.done && (_a = constraints_9.return)) await _a.call(constraints_9);
1273
+ if (!_d && !_a && (_b = constraints_9.return)) await _b.call(constraints_9);
1253
1274
  }
1254
1275
  finally { if (e_11) throw e_11.error; }
1255
1276
  }
@@ -1286,11 +1307,13 @@ class History {
1286
1307
  return null;
1287
1308
  },
1288
1309
  updateCircularPatternConstraints: async (...constraints) => {
1289
- var e_12, _a;
1310
+ var _a, e_12, _b, _c;
1290
1311
  const constrToAdd = [];
1291
1312
  try {
1292
- for (var constraints_10 = __asyncValues(constraints), constraints_10_1; constraints_10_1 = await constraints_10.next(), !constraints_10_1.done;) {
1293
- const constr = constraints_10_1.value;
1313
+ for (var _d = true, constraints_10 = __asyncValues(constraints), constraints_10_1; constraints_10_1 = await constraints_10.next(), _a = constraints_10_1.done, !_a; _d = true) {
1314
+ _c = constraints_10_1.value;
1315
+ _d = false;
1316
+ const constr = _c;
1294
1317
  const [rConstrId, rInstanceId, rWcs1] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.instanceId, constr.mate1.wcsId));
1295
1318
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
1296
1319
  const instanceCountParam = {
@@ -1317,18 +1340,20 @@ class History {
1317
1340
  catch (e_12_1) { e_12 = { error: e_12_1 }; }
1318
1341
  finally {
1319
1342
  try {
1320
- if (constraints_10_1 && !constraints_10_1.done && (_a = constraints_10.return)) await _a.call(constraints_10);
1343
+ if (!_d && !_a && (_b = constraints_10.return)) await _b.call(constraints_10);
1321
1344
  }
1322
1345
  finally { if (e_12) throw e_12.error; }
1323
1346
  }
1324
1347
  await assemblyBuilderAPI.updateCircularPatternConstraints(constrToAdd);
1325
1348
  },
1326
1349
  update3dConstraintValues: async (...constrValues) => {
1327
- var e_13, _a;
1350
+ var _a, e_13, _b, _c;
1328
1351
  const constrValueParams = [];
1329
1352
  try {
1330
- for (var constrValues_1 = __asyncValues(constrValues), constrValues_1_1; constrValues_1_1 = await constrValues_1.next(), !constrValues_1_1.done;) {
1331
- const constrVal = constrValues_1_1.value;
1353
+ for (var _d = true, constrValues_1 = __asyncValues(constrValues), constrValues_1_1; constrValues_1_1 = await constrValues_1.next(), _a = constrValues_1_1.done, !_a; _d = true) {
1354
+ _c = constrValues_1_1.value;
1355
+ _d = false;
1356
+ const constrVal = _c;
1332
1357
  const [rConstrId] = await new Promise(res => this.resolve(ids => res(ids), constrVal.constrId));
1333
1358
  constrValueParams.push({
1334
1359
  constrId: rConstrId,
@@ -1340,7 +1365,7 @@ class History {
1340
1365
  catch (e_13_1) { e_13 = { error: e_13_1 }; }
1341
1366
  finally {
1342
1367
  try {
1343
- if (constrValues_1_1 && !constrValues_1_1.done && (_a = constrValues_1.return)) await _a.call(constrValues_1);
1368
+ if (!_d && !_a && (_b = constrValues_1.return)) await _b.call(constrValues_1);
1344
1369
  }
1345
1370
  finally { if (e_13) throw e_13.error; }
1346
1371
  }
@@ -1403,23 +1428,23 @@ class History {
1403
1428
  }, partId);
1404
1429
  },
1405
1430
  createAssemblyAsTemplate: (name) => {
1406
- return this.resolve(async ([]) => {
1431
+ return this.resolve(async () => {
1407
1432
  return await assemblyBuilderAPI.createAssemblyAsTemplate(name);
1408
1433
  });
1409
1434
  },
1410
1435
  createRootAssembly: (name, options) => {
1411
- return this.resolve(async ([]) => {
1436
+ return this.resolve(async () => {
1412
1437
  return await assemblyBuilderAPI.createRootAssembly(name, options);
1413
1438
  });
1414
1439
  },
1415
1440
  createPart: (name) => {
1416
- return this.resolve(async ([]) => {
1441
+ return this.resolve(async () => {
1417
1442
  const partName = name ? name : 'Part';
1418
1443
  return await featureAPI.newPart(partName);
1419
1444
  });
1420
1445
  },
1421
1446
  createPartAsTemplate: (name) => {
1422
- return this.resolve(async ([]) => {
1447
+ return this.resolve(async () => {
1423
1448
  const partName = name ? name : 'Part';
1424
1449
  return await assemblyBuilderAPI.createPartAsTemplate(partName);
1425
1450
  });
@@ -1518,7 +1543,7 @@ class History {
1518
1543
  },
1519
1544
  selectGeometry: (types, count) => {
1520
1545
  const drId = this.drawingId;
1521
- return this.resolve(async ([]) => {
1546
+ return this.resolve(async () => {
1522
1547
  const filter = (scope, data) => scope === core_1.BuerliScope && types.some(type => type === data);
1523
1548
  // Check count param. If not set use by default 1, else check if not < 1
1524
1549
  const lCount = count ? (count < 1 ? 1 : count) : 1;
@@ -1555,7 +1580,7 @@ class History {
1555
1580
  }, partId);
1556
1581
  },
1557
1582
  getAssemblyTemplate: (asmName) => {
1558
- return this.resolve(async ([]) => {
1583
+ return this.resolve(async () => {
1559
1584
  const asmIds = asmUtils.getAssemblyTemplate(drawingId, asmName);
1560
1585
  if (asmIds != undefined) {
1561
1586
  return Array.isArray(asmIds) ? asmIds : [asmIds];
@@ -1634,7 +1659,7 @@ class History {
1634
1659
  });
1635
1660
  },
1636
1661
  getPartTemplate: (partName) => {
1637
- return this.resolve(async ([]) => {
1662
+ return this.resolve(async () => {
1638
1663
  const partIds = asmUtils.getPartTemplate(drawingId, partName);
1639
1664
  if (partIds != undefined) {
1640
1665
  return Array.isArray(partIds) ? partIds : [partIds];
@@ -1872,11 +1897,13 @@ class History {
1872
1897
  }, id);
1873
1898
  },
1874
1899
  removeInstances: async (...instances) => {
1875
- var e_14, _a;
1900
+ var _a, e_14, _b, _c;
1876
1901
  const instancesToRemove = [];
1877
1902
  try {
1878
- for (var instances_2 = __asyncValues(instances), instances_2_1; instances_2_1 = await instances_2.next(), !instances_2_1.done;) {
1879
- const instance = instances_2_1.value;
1903
+ for (var _d = true, instances_2 = __asyncValues(instances), instances_2_1; instances_2_1 = await instances_2.next(), _a = instances_2_1.done, !_a; _d = true) {
1904
+ _c = instances_2_1.value;
1905
+ _d = false;
1906
+ const instance = _c;
1880
1907
  const [rInstanceId] = await new Promise(res => this.resolve(id => res(id), instance.id));
1881
1908
  let instanceId = rInstanceId;
1882
1909
  if (typeof rInstanceId === 'string') {
@@ -1903,7 +1930,7 @@ class History {
1903
1930
  catch (e_14_1) { e_14 = { error: e_14_1 }; }
1904
1931
  finally {
1905
1932
  try {
1906
- if (instances_2_1 && !instances_2_1.done && (_a = instances_2.return)) await _a.call(instances_2);
1933
+ if (!_d && !_a && (_b = instances_2.return)) await _b.call(instances_2);
1907
1934
  }
1908
1935
  finally { if (e_14) throw e_14.error; }
1909
1936
  }
@@ -1964,11 +1991,13 @@ class History {
1964
1991
  }, sketchId, planeId, axisId, originId);
1965
1992
  },
1966
1993
  transformInstances: async (...instances) => {
1967
- var e_15, _a;
1994
+ var _a, e_15, _b, _c;
1968
1995
  const instancesToTransform = [];
1969
1996
  try {
1970
- for (var instances_3 = __asyncValues(instances), instances_3_1; instances_3_1 = await instances_3.next(), !instances_3_1.done;) {
1971
- const instance = instances_3_1.value;
1997
+ for (var _d = true, instances_3 = __asyncValues(instances), instances_3_1; instances_3_1 = await instances_3.next(), _a = instances_3_1.done, !_a; _d = true) {
1998
+ _c = instances_3_1.value;
1999
+ _d = false;
2000
+ const instance = _c;
1972
2001
  const [rInstanceId] = await new Promise(res => this.resolve(id => res(id), instance.id));
1973
2002
  let instanceId = rInstanceId;
1974
2003
  if (typeof rInstanceId === 'string') {
@@ -1999,7 +2028,7 @@ class History {
1999
2028
  catch (e_15_1) { e_15 = { error: e_15_1 }; }
2000
2029
  finally {
2001
2030
  try {
2002
- if (instances_3_1 && !instances_3_1.done && (_a = instances_3.return)) await _a.call(instances_3);
2031
+ if (!_d && !_a && (_b = instances_3.return)) await _b.call(instances_3);
2003
2032
  }
2004
2033
  finally { if (e_15) throw e_15.error; }
2005
2034
  }
@@ -2070,11 +2099,13 @@ class History {
2070
2099
  }, partId);
2071
2100
  },
2072
2101
  setExpressions: async (...expressions) => {
2073
- var e_16, _a;
2102
+ var _a, e_16, _b, _c;
2074
2103
  const expressionsToSet = [];
2075
2104
  try {
2076
- for (var expressions_1 = __asyncValues(expressions), expressions_1_1; expressions_1_1 = await expressions_1.next(), !expressions_1_1.done;) {
2077
- const expr = expressions_1_1.value;
2105
+ for (var _d = true, expressions_1 = __asyncValues(expressions), expressions_1_1; expressions_1_1 = await expressions_1.next(), _a = expressions_1_1.done, !_a; _d = true) {
2106
+ _c = expressions_1_1.value;
2107
+ _d = false;
2108
+ const expr = _c;
2078
2109
  const [rPartId] = await new Promise(res => this.resolve(id => res(id), expr.partId));
2079
2110
  const membersToModify = [];
2080
2111
  expr.members.forEach((mem) => {
@@ -2115,7 +2146,7 @@ class History {
2115
2146
  catch (e_16_1) { e_16 = { error: e_16_1 }; }
2116
2147
  finally {
2117
2148
  try {
2118
- if (expressions_1_1 && !expressions_1_1.done && (_a = expressions_1.return)) await _a.call(expressions_1);
2149
+ if (!_d && !_a && (_b = expressions_1.return)) await _b.call(expressions_1);
2119
2150
  }
2120
2151
  finally { if (e_16) throw e_16.error; }
2121
2152
  }
@@ -7,21 +7,18 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
7
7
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.solid = exports.Solid = exports.createPolyline = void 0;
11
- /* eslint-disable max-lines */
10
+ exports.solid = exports.Solid = void 0;
11
+ exports.createPolyline = createPolyline;
12
12
  const classcad_1 = require("@buerli.io/classcad");
13
13
  const core_1 = require("@buerli.io/core");
14
14
  const three_1 = require("three");
15
15
  const three_stdlib_1 = require("three-stdlib");
16
16
  const meshes_1 = require("./utils/meshes");
17
17
  const isShape = (entity) => entity && entity.type === 'Shape';
18
- const toCCVec = (args) => ({ x: args[0], y: args[1], z: args[2] });
19
18
  const toCCNbrVec = (args) => ({ x: args[0], y: args[1], z: args[2] });
20
19
  const toArray = (v) => (Array.isArray(v) ? v : v.toArray());
21
20
  const toEuler = (v) => toArray(v);
22
- const makeVec = (v) => toCCVec(toArray(v));
23
21
  const makeNbrVec = (v) => toCCNbrVec(toArray(v));
24
- const makeEuler = (v) => toCCVec(toEuler(v));
25
22
  const makeNbrEuler = (v) => toCCNbrVec(toEuler(v));
26
23
  /**
27
24
  * Returns the entity of solid from structure tree
@@ -146,7 +143,6 @@ function createPolyline(fPts) {
146
143
  }
147
144
  return { points: newVertices, bulges: newBulges };
148
145
  }
149
- exports.createPolyline = createPolyline;
150
146
  /**
151
147
  * Creates the specific curve array from THREE.Shape.curves to draw the region in ClassCAD. It contains the type and all necessary points and control points in a multidimensional array.
152
148
  * @param curves THREE.Shape.curves
@@ -245,7 +241,7 @@ class Solid {
245
241
  }
246
242
  },
247
243
  createScene: async (solids, options) => {
248
- var e_1, _a;
244
+ var _a, e_1, _b, _c;
249
245
  await this.queue;
250
246
  this.queue = Promise.resolve(0);
251
247
  const scene = new three_1.Scene();
@@ -255,8 +251,10 @@ class Solid {
255
251
  const _solids = [];
256
252
  const meshes = [];
257
253
  try {
258
- for (var solids_1 = __asyncValues(solids), solids_1_1; solids_1_1 = await solids_1.next(), !solids_1_1.done;) {
259
- const _solid = solids_1_1.value;
254
+ for (var _d = true, solids_1 = __asyncValues(solids), solids_1_1; solids_1_1 = await solids_1.next(), _a = solids_1_1.done, !_a; _d = true) {
255
+ _c = solids_1_1.value;
256
+ _d = false;
257
+ const _solid = _c;
260
258
  await baseModelerAPI.requestVisualisationOfObject(_solid);
261
259
  const cDrawing = (0, core_1.getDrawing)(drawingId);
262
260
  const solidObject = cDrawing.structure.tree[_solid];
@@ -308,7 +306,7 @@ class Solid {
308
306
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
309
307
  finally {
310
308
  try {
311
- if (solids_1_1 && !solids_1_1.done && (_a = solids_1.return)) await _a.call(solids_1);
309
+ if (!_d && !_a && (_b = solids_1.return)) await _b.call(solids_1);
312
310
  }
313
311
  finally { if (e_1) throw e_1.error; }
314
312
  }
@@ -3,10 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.waitForSelect = void 0;
6
+ exports.waitForSelect = waitForSelect;
7
7
  const core_1 = require("@buerli.io/core");
8
8
  const uuid_1 = require("uuid");
9
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
9
  // @ts-ignore
11
10
  const flat_promise_1 = __importDefault(require("flat-promise"));
12
11
  async function waitForSelect(length, filter, onChange) {
@@ -29,4 +28,3 @@ async function waitForSelect(length, filter, onChange) {
29
28
  selApi && selApi.activateSelector(null);
30
29
  return result;
31
30
  }
32
- exports.waitForSelect = waitForSelect;