@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.
- package/build/cjs/history.js +103 -72
- package/build/cjs/solid.js +8 -10
- package/build/cjs/utils/selection.js +1 -3
- package/build/esm/history.js +103 -72
- package/build/esm/solid.js +6 -8
- package/build/esm/utils/selection.js +0 -1
- package/build/types/history.d.ts +25 -24
- package/build/types/index.d.ts +15 -15
- package/build/types/solid.d.ts +9 -8
- package/build/types/utils/meshes.d.ts +1 -1
- package/build/types/utils/selection.d.ts +1 -1
- package/package.json +18 -14
package/build/esm/history.js
CHANGED
|
@@ -5,7 +5,6 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
5
5
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
6
6
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
7
7
|
};
|
|
8
|
-
/* eslint-disable max-lines */
|
|
9
8
|
import { createApi, CCClasses, ccUtils, DataType, SVGModusType, BuerliCadFacade, } from '@buerli.io/classcad';
|
|
10
9
|
import { api, getDrawing, MathUtils, BuerliScope, createInfo, Measure, } from '@buerli.io/core';
|
|
11
10
|
import { Group, Matrix4, Mesh, MeshStandardMaterial, Scene } from 'three';
|
|
@@ -239,11 +238,13 @@ export class History {
|
|
|
239
238
|
getState: () => api.getState(),
|
|
240
239
|
setFacetingParameters: (distanceTol, angleTol) => this.resolve(async () => cc.v0.common.setFacetingParameters(distanceTol, angleTol)),
|
|
241
240
|
addInstances: async (...instances) => {
|
|
242
|
-
var e_1,
|
|
241
|
+
var _a, e_1, _b, _c;
|
|
243
242
|
const instancesToAdd = [];
|
|
244
243
|
try {
|
|
245
|
-
for (var instances_1 = __asyncValues(instances), instances_1_1; instances_1_1 = await instances_1.next(),
|
|
246
|
-
|
|
244
|
+
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) {
|
|
245
|
+
_c = instances_1_1.value;
|
|
246
|
+
_d = false;
|
|
247
|
+
const instance = _c;
|
|
247
248
|
const [rProductId, rOwnerId] = await new Promise(res => this.resolve(id => res(id), instance.productId, instance.ownerId));
|
|
248
249
|
// Looking for the productId given by an identifier or name
|
|
249
250
|
// Priorities:
|
|
@@ -297,18 +298,20 @@ export class History {
|
|
|
297
298
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
298
299
|
finally {
|
|
299
300
|
try {
|
|
300
|
-
if (
|
|
301
|
+
if (!_d && !_a && (_b = instances_1.return)) await _b.call(instances_1);
|
|
301
302
|
}
|
|
302
303
|
finally { if (e_1) throw e_1.error; }
|
|
303
304
|
}
|
|
304
305
|
return assemblyBuilderAPI.addInstances(instancesToAdd);
|
|
305
306
|
},
|
|
306
307
|
addDimensions: async (...dimensions) => {
|
|
307
|
-
var e_2,
|
|
308
|
+
var _a, e_2, _b, _c;
|
|
308
309
|
const dimParamsToAdd = [];
|
|
309
310
|
try {
|
|
310
|
-
for (var dimensions_1 = __asyncValues(dimensions), dimensions_1_1; dimensions_1_1 = await dimensions_1.next(),
|
|
311
|
-
|
|
311
|
+
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) {
|
|
312
|
+
_c = dimensions_1_1.value;
|
|
313
|
+
_d = false;
|
|
314
|
+
const dim = _c;
|
|
312
315
|
const [rProductId] = await new Promise(res => this.resolve(id => res(id), dim.productId));
|
|
313
316
|
switch (dim.param.type) {
|
|
314
317
|
case CCClasses.CCLinearDimension:
|
|
@@ -335,7 +338,7 @@ export class History {
|
|
|
335
338
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
336
339
|
finally {
|
|
337
340
|
try {
|
|
338
|
-
if (
|
|
341
|
+
if (!_d && !_a && (_b = dimensions_1.return)) await _b.call(dimensions_1);
|
|
339
342
|
}
|
|
340
343
|
finally { if (e_2) throw e_2.error; }
|
|
341
344
|
}
|
|
@@ -610,11 +613,13 @@ export class History {
|
|
|
610
613
|
return null;
|
|
611
614
|
},
|
|
612
615
|
updateFastenedConstraints: async (...constraints) => {
|
|
613
|
-
var e_3,
|
|
616
|
+
var _a, e_3, _b, _c;
|
|
614
617
|
const constrToAdd = [];
|
|
615
618
|
try {
|
|
616
|
-
for (var constraints_1 = __asyncValues(constraints), constraints_1_1; constraints_1_1 = await constraints_1.next(),
|
|
617
|
-
|
|
619
|
+
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) {
|
|
620
|
+
_c = constraints_1_1.value;
|
|
621
|
+
_d = false;
|
|
622
|
+
const constr = _c;
|
|
618
623
|
const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
|
|
619
624
|
const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
620
625
|
const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
|
|
@@ -659,7 +664,7 @@ export class History {
|
|
|
659
664
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
660
665
|
finally {
|
|
661
666
|
try {
|
|
662
|
-
if (
|
|
667
|
+
if (!_d && !_a && (_b = constraints_1.return)) await _b.call(constraints_1);
|
|
663
668
|
}
|
|
664
669
|
finally { if (e_3) throw e_3.error; }
|
|
665
670
|
}
|
|
@@ -693,11 +698,13 @@ export class History {
|
|
|
693
698
|
return null;
|
|
694
699
|
},
|
|
695
700
|
updateFastenedOriginConstraints: async (...constraints) => {
|
|
696
|
-
var e_4,
|
|
701
|
+
var _a, e_4, _b, _c;
|
|
697
702
|
const constraintsToAdd = [];
|
|
698
703
|
try {
|
|
699
|
-
for (var constraints_2 = __asyncValues(constraints), constraints_2_1; constraints_2_1 = await constraints_2.next(),
|
|
700
|
-
|
|
704
|
+
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) {
|
|
705
|
+
_c = constraints_2_1.value;
|
|
706
|
+
_d = false;
|
|
707
|
+
const constr = _c;
|
|
701
708
|
const [rConstrId, rWcs1] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId));
|
|
702
709
|
const rMatePath = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
703
710
|
const xOffsetParam = { value: constr.xOffset, isExpr: typeof constr.xOffset === 'string' };
|
|
@@ -735,7 +742,7 @@ export class History {
|
|
|
735
742
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
736
743
|
finally {
|
|
737
744
|
try {
|
|
738
|
-
if (
|
|
745
|
+
if (!_d && !_a && (_b = constraints_2.return)) await _b.call(constraints_2);
|
|
739
746
|
}
|
|
740
747
|
finally { if (e_4) throw e_4.error; }
|
|
741
748
|
}
|
|
@@ -771,11 +778,13 @@ export class History {
|
|
|
771
778
|
return null;
|
|
772
779
|
},
|
|
773
780
|
updateCylindricalConstraints: async (...constraints) => {
|
|
774
|
-
var e_5,
|
|
781
|
+
var _a, e_5, _b, _c;
|
|
775
782
|
const constrToAdd = [];
|
|
776
783
|
try {
|
|
777
|
-
for (var constraints_3 = __asyncValues(constraints), constraints_3_1; constraints_3_1 = await constraints_3.next(),
|
|
778
|
-
|
|
784
|
+
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) {
|
|
785
|
+
_c = constraints_3_1.value;
|
|
786
|
+
_d = false;
|
|
787
|
+
const constr = _c;
|
|
779
788
|
const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
|
|
780
789
|
const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
781
790
|
const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
|
|
@@ -801,7 +810,7 @@ export class History {
|
|
|
801
810
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
802
811
|
finally {
|
|
803
812
|
try {
|
|
804
|
-
if (
|
|
813
|
+
if (!_d && !_a && (_b = constraints_3.return)) await _b.call(constraints_3);
|
|
805
814
|
}
|
|
806
815
|
finally { if (e_5) throw e_5.error; }
|
|
807
816
|
}
|
|
@@ -838,11 +847,13 @@ export class History {
|
|
|
838
847
|
return null;
|
|
839
848
|
},
|
|
840
849
|
updateRevoluteConstraints: async (...constraints) => {
|
|
841
|
-
var e_6,
|
|
850
|
+
var _a, e_6, _b, _c;
|
|
842
851
|
const constrToAdd = [];
|
|
843
852
|
try {
|
|
844
|
-
for (var constraints_4 = __asyncValues(constraints), constraints_4_1; constraints_4_1 = await constraints_4.next(),
|
|
845
|
-
|
|
853
|
+
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) {
|
|
854
|
+
_c = constraints_4_1.value;
|
|
855
|
+
_d = false;
|
|
856
|
+
const constr = _c;
|
|
846
857
|
const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
|
|
847
858
|
const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
848
859
|
const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
|
|
@@ -869,7 +880,7 @@ export class History {
|
|
|
869
880
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
870
881
|
finally {
|
|
871
882
|
try {
|
|
872
|
-
if (
|
|
883
|
+
if (!_d && !_a && (_b = constraints_4.return)) await _b.call(constraints_4);
|
|
873
884
|
}
|
|
874
885
|
finally { if (e_6) throw e_6.error; }
|
|
875
886
|
}
|
|
@@ -908,11 +919,13 @@ export class History {
|
|
|
908
919
|
return null;
|
|
909
920
|
},
|
|
910
921
|
updateSliderConstraints: async (...constraints) => {
|
|
911
|
-
var e_7,
|
|
922
|
+
var _a, e_7, _b, _c;
|
|
912
923
|
const constrToAdd = [];
|
|
913
924
|
try {
|
|
914
|
-
for (var constraints_5 = __asyncValues(constraints), constraints_5_1; constraints_5_1 = await constraints_5.next(),
|
|
915
|
-
|
|
925
|
+
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) {
|
|
926
|
+
_c = constraints_5_1.value;
|
|
927
|
+
_d = false;
|
|
928
|
+
const constr = _c;
|
|
916
929
|
const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
|
|
917
930
|
const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
918
931
|
const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
|
|
@@ -941,7 +954,7 @@ export class History {
|
|
|
941
954
|
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
942
955
|
finally {
|
|
943
956
|
try {
|
|
944
|
-
if (
|
|
957
|
+
if (!_d && !_a && (_b = constraints_5.return)) await _b.call(constraints_5);
|
|
945
958
|
}
|
|
946
959
|
finally { if (e_7) throw e_7.error; }
|
|
947
960
|
}
|
|
@@ -980,11 +993,13 @@ export class History {
|
|
|
980
993
|
return null;
|
|
981
994
|
},
|
|
982
995
|
updatePlanarConstraints: async (...constraints) => {
|
|
983
|
-
var e_8,
|
|
996
|
+
var _a, e_8, _b, _c;
|
|
984
997
|
const constrToAdd = [];
|
|
985
998
|
try {
|
|
986
|
-
for (var constraints_6 = __asyncValues(constraints), constraints_6_1; constraints_6_1 = await constraints_6.next(),
|
|
987
|
-
|
|
999
|
+
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) {
|
|
1000
|
+
_c = constraints_6_1.value;
|
|
1001
|
+
_d = false;
|
|
1002
|
+
const constr = _c;
|
|
988
1003
|
const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
|
|
989
1004
|
const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
990
1005
|
const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
|
|
@@ -1013,7 +1028,7 @@ export class History {
|
|
|
1013
1028
|
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1014
1029
|
finally {
|
|
1015
1030
|
try {
|
|
1016
|
-
if (
|
|
1031
|
+
if (!_d && !_a && (_b = constraints_6.return)) await _b.call(constraints_6);
|
|
1017
1032
|
}
|
|
1018
1033
|
finally { if (e_8) throw e_8.error; }
|
|
1019
1034
|
}
|
|
@@ -1051,11 +1066,13 @@ export class History {
|
|
|
1051
1066
|
return null;
|
|
1052
1067
|
},
|
|
1053
1068
|
updateParallelConstraints: async (...constraints) => {
|
|
1054
|
-
var e_9,
|
|
1069
|
+
var _a, e_9, _b, _c;
|
|
1055
1070
|
const constrToAdd = [];
|
|
1056
1071
|
try {
|
|
1057
|
-
for (var constraints_7 = __asyncValues(constraints), constraints_7_1; constraints_7_1 = await constraints_7.next(),
|
|
1058
|
-
|
|
1072
|
+
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) {
|
|
1073
|
+
_c = constraints_7_1.value;
|
|
1074
|
+
_d = false;
|
|
1075
|
+
const constr = _c;
|
|
1059
1076
|
const [rConstrId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.mate1.wcsId, constr.mate2.wcsId));
|
|
1060
1077
|
const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
1061
1078
|
const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate2.matePath));
|
|
@@ -1083,7 +1100,7 @@ export class History {
|
|
|
1083
1100
|
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1084
1101
|
finally {
|
|
1085
1102
|
try {
|
|
1086
|
-
if (
|
|
1103
|
+
if (!_d && !_a && (_b = constraints_7.return)) await _b.call(constraints_7);
|
|
1087
1104
|
}
|
|
1088
1105
|
finally { if (e_9) throw e_9.error; }
|
|
1089
1106
|
}
|
|
@@ -1105,11 +1122,13 @@ export class History {
|
|
|
1105
1122
|
return null;
|
|
1106
1123
|
},
|
|
1107
1124
|
updateGroupConstraints: async (...constraints) => {
|
|
1108
|
-
var e_10,
|
|
1125
|
+
var _a, e_10, _b, _c;
|
|
1109
1126
|
const constrToAdd = [];
|
|
1110
1127
|
try {
|
|
1111
|
-
for (var constraints_8 = __asyncValues(constraints), constraints_8_1; constraints_8_1 = await constraints_8.next(),
|
|
1112
|
-
|
|
1128
|
+
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) {
|
|
1129
|
+
_c = constraints_8_1.value;
|
|
1130
|
+
_d = false;
|
|
1131
|
+
const constr = _c;
|
|
1113
1132
|
const [rConstrId] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId));
|
|
1114
1133
|
const rInstanceIds = await new Promise(res => this.resolve(paths => res(paths), ...constr.instanceIds));
|
|
1115
1134
|
constrToAdd.push({
|
|
@@ -1121,7 +1140,7 @@ export class History {
|
|
|
1121
1140
|
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1122
1141
|
finally {
|
|
1123
1142
|
try {
|
|
1124
|
-
if (
|
|
1143
|
+
if (!_d && !_a && (_b = constraints_8.return)) await _b.call(constraints_8);
|
|
1125
1144
|
}
|
|
1126
1145
|
finally { if (e_10) throw e_10.error; }
|
|
1127
1146
|
}
|
|
@@ -1185,11 +1204,13 @@ export class History {
|
|
|
1185
1204
|
return null;
|
|
1186
1205
|
},
|
|
1187
1206
|
updateLinearPatternConstraints: async (...constraints) => {
|
|
1188
|
-
var e_11,
|
|
1207
|
+
var _a, e_11, _b, _c;
|
|
1189
1208
|
const constrToAdd = [];
|
|
1190
1209
|
try {
|
|
1191
|
-
for (var constraints_9 = __asyncValues(constraints), constraints_9_1; constraints_9_1 = await constraints_9.next(),
|
|
1192
|
-
|
|
1210
|
+
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) {
|
|
1211
|
+
_c = constraints_9_1.value;
|
|
1212
|
+
_d = false;
|
|
1213
|
+
const constr = _c;
|
|
1193
1214
|
const [rConstrId, rInstanceId, rWcs1, rWcs2] = await new Promise(res => {
|
|
1194
1215
|
var _a;
|
|
1195
1216
|
return this.resolve(ids => res(ids), constr.constrId, constr.instanceId, constr.mate1.wcsId, (_a = constr.mate2) === null || _a === void 0 ? void 0 : _a.wcsId);
|
|
@@ -1246,7 +1267,7 @@ export class History {
|
|
|
1246
1267
|
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1247
1268
|
finally {
|
|
1248
1269
|
try {
|
|
1249
|
-
if (
|
|
1270
|
+
if (!_d && !_a && (_b = constraints_9.return)) await _b.call(constraints_9);
|
|
1250
1271
|
}
|
|
1251
1272
|
finally { if (e_11) throw e_11.error; }
|
|
1252
1273
|
}
|
|
@@ -1283,11 +1304,13 @@ export class History {
|
|
|
1283
1304
|
return null;
|
|
1284
1305
|
},
|
|
1285
1306
|
updateCircularPatternConstraints: async (...constraints) => {
|
|
1286
|
-
var e_12,
|
|
1307
|
+
var _a, e_12, _b, _c;
|
|
1287
1308
|
const constrToAdd = [];
|
|
1288
1309
|
try {
|
|
1289
|
-
for (var constraints_10 = __asyncValues(constraints), constraints_10_1; constraints_10_1 = await constraints_10.next(),
|
|
1290
|
-
|
|
1310
|
+
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) {
|
|
1311
|
+
_c = constraints_10_1.value;
|
|
1312
|
+
_d = false;
|
|
1313
|
+
const constr = _c;
|
|
1291
1314
|
const [rConstrId, rInstanceId, rWcs1] = await new Promise(res => this.resolve(ids => res(ids), constr.constrId, constr.instanceId, constr.mate1.wcsId));
|
|
1292
1315
|
const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...constr.mate1.matePath));
|
|
1293
1316
|
const instanceCountParam = {
|
|
@@ -1314,18 +1337,20 @@ export class History {
|
|
|
1314
1337
|
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1315
1338
|
finally {
|
|
1316
1339
|
try {
|
|
1317
|
-
if (
|
|
1340
|
+
if (!_d && !_a && (_b = constraints_10.return)) await _b.call(constraints_10);
|
|
1318
1341
|
}
|
|
1319
1342
|
finally { if (e_12) throw e_12.error; }
|
|
1320
1343
|
}
|
|
1321
1344
|
await assemblyBuilderAPI.updateCircularPatternConstraints(constrToAdd);
|
|
1322
1345
|
},
|
|
1323
1346
|
update3dConstraintValues: async (...constrValues) => {
|
|
1324
|
-
var e_13,
|
|
1347
|
+
var _a, e_13, _b, _c;
|
|
1325
1348
|
const constrValueParams = [];
|
|
1326
1349
|
try {
|
|
1327
|
-
for (var constrValues_1 = __asyncValues(constrValues), constrValues_1_1; constrValues_1_1 = await constrValues_1.next(),
|
|
1328
|
-
|
|
1350
|
+
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) {
|
|
1351
|
+
_c = constrValues_1_1.value;
|
|
1352
|
+
_d = false;
|
|
1353
|
+
const constrVal = _c;
|
|
1329
1354
|
const [rConstrId] = await new Promise(res => this.resolve(ids => res(ids), constrVal.constrId));
|
|
1330
1355
|
constrValueParams.push({
|
|
1331
1356
|
constrId: rConstrId,
|
|
@@ -1337,7 +1362,7 @@ export class History {
|
|
|
1337
1362
|
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1338
1363
|
finally {
|
|
1339
1364
|
try {
|
|
1340
|
-
if (
|
|
1365
|
+
if (!_d && !_a && (_b = constrValues_1.return)) await _b.call(constrValues_1);
|
|
1341
1366
|
}
|
|
1342
1367
|
finally { if (e_13) throw e_13.error; }
|
|
1343
1368
|
}
|
|
@@ -1400,23 +1425,23 @@ export class History {
|
|
|
1400
1425
|
}, partId);
|
|
1401
1426
|
},
|
|
1402
1427
|
createAssemblyAsTemplate: (name) => {
|
|
1403
|
-
return this.resolve(async (
|
|
1428
|
+
return this.resolve(async () => {
|
|
1404
1429
|
return await assemblyBuilderAPI.createAssemblyAsTemplate(name);
|
|
1405
1430
|
});
|
|
1406
1431
|
},
|
|
1407
1432
|
createRootAssembly: (name, options) => {
|
|
1408
|
-
return this.resolve(async (
|
|
1433
|
+
return this.resolve(async () => {
|
|
1409
1434
|
return await assemblyBuilderAPI.createRootAssembly(name, options);
|
|
1410
1435
|
});
|
|
1411
1436
|
},
|
|
1412
1437
|
createPart: (name) => {
|
|
1413
|
-
return this.resolve(async (
|
|
1438
|
+
return this.resolve(async () => {
|
|
1414
1439
|
const partName = name ? name : 'Part';
|
|
1415
1440
|
return await featureAPI.newPart(partName);
|
|
1416
1441
|
});
|
|
1417
1442
|
},
|
|
1418
1443
|
createPartAsTemplate: (name) => {
|
|
1419
|
-
return this.resolve(async (
|
|
1444
|
+
return this.resolve(async () => {
|
|
1420
1445
|
const partName = name ? name : 'Part';
|
|
1421
1446
|
return await assemblyBuilderAPI.createPartAsTemplate(partName);
|
|
1422
1447
|
});
|
|
@@ -1515,7 +1540,7 @@ export class History {
|
|
|
1515
1540
|
},
|
|
1516
1541
|
selectGeometry: (types, count) => {
|
|
1517
1542
|
const drId = this.drawingId;
|
|
1518
|
-
return this.resolve(async (
|
|
1543
|
+
return this.resolve(async () => {
|
|
1519
1544
|
const filter = (scope, data) => scope === BuerliScope && types.some(type => type === data);
|
|
1520
1545
|
// Check count param. If not set use by default 1, else check if not < 1
|
|
1521
1546
|
const lCount = count ? (count < 1 ? 1 : count) : 1;
|
|
@@ -1552,7 +1577,7 @@ export class History {
|
|
|
1552
1577
|
}, partId);
|
|
1553
1578
|
},
|
|
1554
1579
|
getAssemblyTemplate: (asmName) => {
|
|
1555
|
-
return this.resolve(async (
|
|
1580
|
+
return this.resolve(async () => {
|
|
1556
1581
|
const asmIds = asmUtils.getAssemblyTemplate(drawingId, asmName);
|
|
1557
1582
|
if (asmIds != undefined) {
|
|
1558
1583
|
return Array.isArray(asmIds) ? asmIds : [asmIds];
|
|
@@ -1631,7 +1656,7 @@ export class History {
|
|
|
1631
1656
|
});
|
|
1632
1657
|
},
|
|
1633
1658
|
getPartTemplate: (partName) => {
|
|
1634
|
-
return this.resolve(async (
|
|
1659
|
+
return this.resolve(async () => {
|
|
1635
1660
|
const partIds = asmUtils.getPartTemplate(drawingId, partName);
|
|
1636
1661
|
if (partIds != undefined) {
|
|
1637
1662
|
return Array.isArray(partIds) ? partIds : [partIds];
|
|
@@ -1869,11 +1894,13 @@ export class History {
|
|
|
1869
1894
|
}, id);
|
|
1870
1895
|
},
|
|
1871
1896
|
removeInstances: async (...instances) => {
|
|
1872
|
-
var e_14,
|
|
1897
|
+
var _a, e_14, _b, _c;
|
|
1873
1898
|
const instancesToRemove = [];
|
|
1874
1899
|
try {
|
|
1875
|
-
for (var instances_2 = __asyncValues(instances), instances_2_1; instances_2_1 = await instances_2.next(),
|
|
1876
|
-
|
|
1900
|
+
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) {
|
|
1901
|
+
_c = instances_2_1.value;
|
|
1902
|
+
_d = false;
|
|
1903
|
+
const instance = _c;
|
|
1877
1904
|
const [rInstanceId] = await new Promise(res => this.resolve(id => res(id), instance.id));
|
|
1878
1905
|
let instanceId = rInstanceId;
|
|
1879
1906
|
if (typeof rInstanceId === 'string') {
|
|
@@ -1900,7 +1927,7 @@ export class History {
|
|
|
1900
1927
|
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1901
1928
|
finally {
|
|
1902
1929
|
try {
|
|
1903
|
-
if (
|
|
1930
|
+
if (!_d && !_a && (_b = instances_2.return)) await _b.call(instances_2);
|
|
1904
1931
|
}
|
|
1905
1932
|
finally { if (e_14) throw e_14.error; }
|
|
1906
1933
|
}
|
|
@@ -1961,11 +1988,13 @@ export class History {
|
|
|
1961
1988
|
}, sketchId, planeId, axisId, originId);
|
|
1962
1989
|
},
|
|
1963
1990
|
transformInstances: async (...instances) => {
|
|
1964
|
-
var e_15,
|
|
1991
|
+
var _a, e_15, _b, _c;
|
|
1965
1992
|
const instancesToTransform = [];
|
|
1966
1993
|
try {
|
|
1967
|
-
for (var instances_3 = __asyncValues(instances), instances_3_1; instances_3_1 = await instances_3.next(),
|
|
1968
|
-
|
|
1994
|
+
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) {
|
|
1995
|
+
_c = instances_3_1.value;
|
|
1996
|
+
_d = false;
|
|
1997
|
+
const instance = _c;
|
|
1969
1998
|
const [rInstanceId] = await new Promise(res => this.resolve(id => res(id), instance.id));
|
|
1970
1999
|
let instanceId = rInstanceId;
|
|
1971
2000
|
if (typeof rInstanceId === 'string') {
|
|
@@ -1996,7 +2025,7 @@ export class History {
|
|
|
1996
2025
|
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1997
2026
|
finally {
|
|
1998
2027
|
try {
|
|
1999
|
-
if (
|
|
2028
|
+
if (!_d && !_a && (_b = instances_3.return)) await _b.call(instances_3);
|
|
2000
2029
|
}
|
|
2001
2030
|
finally { if (e_15) throw e_15.error; }
|
|
2002
2031
|
}
|
|
@@ -2067,11 +2096,13 @@ export class History {
|
|
|
2067
2096
|
}, partId);
|
|
2068
2097
|
},
|
|
2069
2098
|
setExpressions: async (...expressions) => {
|
|
2070
|
-
var e_16,
|
|
2099
|
+
var _a, e_16, _b, _c;
|
|
2071
2100
|
const expressionsToSet = [];
|
|
2072
2101
|
try {
|
|
2073
|
-
for (var expressions_1 = __asyncValues(expressions), expressions_1_1; expressions_1_1 = await expressions_1.next(),
|
|
2074
|
-
|
|
2102
|
+
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) {
|
|
2103
|
+
_c = expressions_1_1.value;
|
|
2104
|
+
_d = false;
|
|
2105
|
+
const expr = _c;
|
|
2075
2106
|
const [rPartId] = await new Promise(res => this.resolve(id => res(id), expr.partId));
|
|
2076
2107
|
const membersToModify = [];
|
|
2077
2108
|
expr.members.forEach((mem) => {
|
|
@@ -2112,7 +2143,7 @@ export class History {
|
|
|
2112
2143
|
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
2113
2144
|
finally {
|
|
2114
2145
|
try {
|
|
2115
|
-
if (
|
|
2146
|
+
if (!_d && !_a && (_b = expressions_1.return)) await _b.call(expressions_1);
|
|
2116
2147
|
}
|
|
2117
2148
|
finally { if (e_16) throw e_16.error; }
|
|
2118
2149
|
}
|
package/build/esm/solid.js
CHANGED
|
@@ -5,20 +5,16 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
5
5
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
6
6
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
7
7
|
};
|
|
8
|
-
/* eslint-disable max-lines */
|
|
9
8
|
import { createApi, BuerliCadFacade } from '@buerli.io/classcad';
|
|
10
9
|
import { api, getDrawing } from '@buerli.io/core';
|
|
11
10
|
import { Group, Mesh, MeshStandardMaterial, Scene } from 'three';
|
|
12
11
|
import { mergeBufferGeometries } from 'three-stdlib';
|
|
13
12
|
import { getDifferentColoredMeshesFromEntity } from './utils/meshes';
|
|
14
13
|
const isShape = (entity) => entity && entity.type === 'Shape';
|
|
15
|
-
const toCCVec = (args) => ({ x: args[0], y: args[1], z: args[2] });
|
|
16
14
|
const toCCNbrVec = (args) => ({ x: args[0], y: args[1], z: args[2] });
|
|
17
15
|
const toArray = (v) => (Array.isArray(v) ? v : v.toArray());
|
|
18
16
|
const toEuler = (v) => toArray(v);
|
|
19
|
-
const makeVec = (v) => toCCVec(toArray(v));
|
|
20
17
|
const makeNbrVec = (v) => toCCNbrVec(toArray(v));
|
|
21
|
-
const makeEuler = (v) => toCCVec(toEuler(v));
|
|
22
18
|
const makeNbrEuler = (v) => toCCNbrVec(toEuler(v));
|
|
23
19
|
/**
|
|
24
20
|
* Returns the entity of solid from structure tree
|
|
@@ -241,7 +237,7 @@ export class Solid {
|
|
|
241
237
|
}
|
|
242
238
|
},
|
|
243
239
|
createScene: async (solids, options) => {
|
|
244
|
-
var e_1,
|
|
240
|
+
var _a, e_1, _b, _c;
|
|
245
241
|
await this.queue;
|
|
246
242
|
this.queue = Promise.resolve(0);
|
|
247
243
|
const scene = new Scene();
|
|
@@ -251,8 +247,10 @@ export class Solid {
|
|
|
251
247
|
const _solids = [];
|
|
252
248
|
const meshes = [];
|
|
253
249
|
try {
|
|
254
|
-
for (var solids_1 = __asyncValues(solids), solids_1_1; solids_1_1 = await solids_1.next(),
|
|
255
|
-
|
|
250
|
+
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) {
|
|
251
|
+
_c = solids_1_1.value;
|
|
252
|
+
_d = false;
|
|
253
|
+
const _solid = _c;
|
|
256
254
|
await baseModelerAPI.requestVisualisationOfObject(_solid);
|
|
257
255
|
const cDrawing = getDrawing(drawingId);
|
|
258
256
|
const solidObject = cDrawing.structure.tree[_solid];
|
|
@@ -304,7 +302,7 @@ export class Solid {
|
|
|
304
302
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
305
303
|
finally {
|
|
306
304
|
try {
|
|
307
|
-
if (
|
|
305
|
+
if (!_d && !_a && (_b = solids_1.return)) await _b.call(solids_1);
|
|
308
306
|
}
|
|
309
307
|
finally { if (e_1) throw e_1.error; }
|
|
310
308
|
}
|