@jwc/jscad-raspberrypi 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/active-cooling-fan.jscad +136 -141
- package/dist/examples/bplus.jscad +136 -141
- package/dist/examples/bplus3.jscad +136 -141
- package/dist/examples/camera-module-v1.jscad +136 -141
- package/dist/examples/camera-module-v2.jscad +136 -141
- package/dist/examples/example.jscad +136 -141
- package/dist/examples/hat-standoff.jscad +136 -141
- package/dist/examples/hat.jscad +136 -141
- package/dist/examples/hq_camera-module.jscad +136 -141
- package/dist/examples/miniPiTFT.jscad +136 -141
- package/dist/examples/pi-tft22.jscad +136 -141
- package/dist/examples/pi-tft24.jscad +136 -141
- package/dist/examples/pi4.jscad +136 -141
- package/dist/examples/pi5.jscad +136 -141
- package/dist/examples/spacer.jscad +136 -141
- package/dist/index.js +1 -1
- package/dist/v1compat.js +1 -1
- package/package.json +3 -3
|
@@ -166,7 +166,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
166
166
|
return divxyz;
|
|
167
167
|
},
|
|
168
168
|
get div() {
|
|
169
|
-
return div
|
|
169
|
+
return div;
|
|
170
170
|
},
|
|
171
171
|
get mulxyz() {
|
|
172
172
|
return mulxyz;
|
|
@@ -298,104 +298,98 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
298
298
|
return addConnector;
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
|
-
function
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
return typeof obj;
|
|
306
|
-
};
|
|
307
|
-
} else {
|
|
308
|
-
_typeof = function(obj) {
|
|
309
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
return _typeof(obj);
|
|
313
|
-
}
|
|
314
|
-
function _defineProperty(obj, key, value) {
|
|
315
|
-
if (key in obj) {
|
|
316
|
-
Object.defineProperty(obj, key, {
|
|
317
|
-
value,
|
|
318
|
-
enumerable: true,
|
|
319
|
-
configurable: true,
|
|
320
|
-
writable: true
|
|
321
|
-
});
|
|
322
|
-
} else {
|
|
323
|
-
obj[key] = value;
|
|
324
|
-
}
|
|
325
|
-
return obj;
|
|
301
|
+
function _arrayLikeToArray(r, a) {
|
|
302
|
+
(null == a || a > r.length) && (a = r.length);
|
|
303
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
304
|
+
return n;
|
|
326
305
|
}
|
|
327
|
-
function
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
function
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
306
|
+
function _arrayWithHoles(r) {
|
|
307
|
+
if (Array.isArray(r)) return r;
|
|
308
|
+
}
|
|
309
|
+
function _defineProperty(e, r, t) {
|
|
310
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
311
|
+
value: t,
|
|
312
|
+
enumerable: !0,
|
|
313
|
+
configurable: !0,
|
|
314
|
+
writable: !0
|
|
315
|
+
}) : e[r] = t, e;
|
|
316
|
+
}
|
|
317
|
+
function _iterableToArrayLimit(r, l) {
|
|
318
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
319
|
+
if (null != t) {
|
|
320
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
321
|
+
try {
|
|
322
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
323
|
+
if (Object(t) !== t) return;
|
|
324
|
+
f = !1;
|
|
325
|
+
} else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
|
|
326
|
+
} catch (r) {
|
|
327
|
+
o = !0, n = r;
|
|
328
|
+
} finally {
|
|
329
|
+
try {
|
|
330
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
331
|
+
} finally {
|
|
332
|
+
if (o) throw n;
|
|
333
|
+
}
|
|
351
334
|
}
|
|
335
|
+
return a;
|
|
352
336
|
}
|
|
353
|
-
return target;
|
|
354
337
|
}
|
|
355
|
-
function
|
|
356
|
-
|
|
338
|
+
function _nonIterableRest() {
|
|
339
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
357
340
|
}
|
|
358
|
-
function
|
|
359
|
-
|
|
341
|
+
function ownKeys(e, r) {
|
|
342
|
+
var t = Object.keys(e);
|
|
343
|
+
if (Object.getOwnPropertySymbols) {
|
|
344
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
345
|
+
r && (o = o.filter(function(r) {
|
|
346
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
347
|
+
})), t.push.apply(t, o);
|
|
348
|
+
}
|
|
349
|
+
return t;
|
|
360
350
|
}
|
|
361
|
-
function
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
351
|
+
function _objectSpread2(e) {
|
|
352
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
353
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
354
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
355
|
+
_defineProperty(e, r, t[r]);
|
|
356
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
357
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
return e;
|
|
361
|
+
}
|
|
362
|
+
function _slicedToArray(r, e) {
|
|
363
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
364
|
+
}
|
|
365
|
+
function _toPrimitive(t, r) {
|
|
366
|
+
if ("object" != typeof t || !t) return t;
|
|
367
|
+
var e = t[Symbol.toPrimitive];
|
|
368
|
+
if (void 0 !== e) {
|
|
369
|
+
var i = e.call(t, r || "default");
|
|
370
|
+
if ("object" != typeof i) return i;
|
|
371
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
381
372
|
}
|
|
382
|
-
return
|
|
373
|
+
return ("string" === r ? String : Number)(t);
|
|
383
374
|
}
|
|
384
|
-
function
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
388
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
389
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
390
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
375
|
+
function _toPropertyKey(t) {
|
|
376
|
+
var i = _toPrimitive(t, "string");
|
|
377
|
+
return "symbol" == typeof i ? i : i + "";
|
|
391
378
|
}
|
|
392
|
-
function
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
379
|
+
function _typeof(o) {
|
|
380
|
+
"@babel/helpers - typeof";
|
|
381
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
382
|
+
return typeof o;
|
|
383
|
+
} : function(o) {
|
|
384
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
385
|
+
}, _typeof(o);
|
|
396
386
|
}
|
|
397
|
-
function
|
|
398
|
-
|
|
387
|
+
function _unsupportedIterableToArray(r, a) {
|
|
388
|
+
if (r) {
|
|
389
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
390
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
391
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
392
|
+
}
|
|
399
393
|
}
|
|
400
394
|
var toRadians = function toRadians(deg) {
|
|
401
395
|
return deg / 180 * Math.PI;
|
|
@@ -455,7 +449,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
455
449
|
solve90ac,
|
|
456
450
|
solveab
|
|
457
451
|
});
|
|
458
|
-
var div = function div(a, f) {
|
|
452
|
+
var div$1 = function div(a, f) {
|
|
459
453
|
return a.map(function(e) {
|
|
460
454
|
return e / f;
|
|
461
455
|
});
|
|
@@ -510,7 +504,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
510
504
|
};
|
|
511
505
|
var array = Object.freeze({
|
|
512
506
|
__proto__: null,
|
|
513
|
-
div,
|
|
507
|
+
div: div$1,
|
|
514
508
|
addValue,
|
|
515
509
|
addArray,
|
|
516
510
|
add,
|
|
@@ -860,7 +854,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
860
854
|
var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
|
|
861
855
|
var union = scadApi__default["default"].booleanOps.union;
|
|
862
856
|
init(CSG);
|
|
863
|
-
var debug = Debug("jscadUtils:group");
|
|
857
|
+
var debug$3 = Debug("jscadUtils:group");
|
|
864
858
|
function JsCadUtilsGroup() {
|
|
865
859
|
var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
866
860
|
var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -871,7 +865,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
871
865
|
this.holes = holes;
|
|
872
866
|
}
|
|
873
867
|
JsCadUtilsGroup.prototype.add = function(object, name, hidden, subparts, parts) {
|
|
874
|
-
debug("add", object, name, hidden, subparts, parts);
|
|
868
|
+
debug$3("add", object, name, hidden, subparts, parts);
|
|
875
869
|
var self = this;
|
|
876
870
|
if (object.parts) {
|
|
877
871
|
if (name) {
|
|
@@ -906,13 +900,14 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
906
900
|
if (pieces.length === 0) {
|
|
907
901
|
throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
|
|
908
902
|
}
|
|
909
|
-
debug("combine", self.names, self.parts);
|
|
903
|
+
debug$3("combine", self.names, self.parts);
|
|
910
904
|
var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
|
|
905
|
+
debug$3("combine mapPick", value, key, object);
|
|
911
906
|
return map ? map(value, key, index, object) : identity(value);
|
|
912
907
|
}, self.name));
|
|
913
908
|
return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
|
|
914
909
|
} catch (err) {
|
|
915
|
-
debug("combine error", this, pieces, options, err);
|
|
910
|
+
debug$3("combine error", this, pieces, options, err);
|
|
916
911
|
throw error('group::combine error "'.concat(err.message || err.toString(), '"\nthis: ').concat(this, '\npieces: "').concat(pieces, '"\noptions: ').concat(JSON.stringify(options, null, 2), "\nstack: ").concat(err.stack, "\n"), "JSCAD_UTILS_GROUP_ERROR");
|
|
917
912
|
}
|
|
918
913
|
};
|
|
@@ -936,7 +931,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
936
931
|
return self;
|
|
937
932
|
};
|
|
938
933
|
JsCadUtilsGroup.prototype.clone = function(name, map) {
|
|
939
|
-
debug("clone", name, _typeof(name), map);
|
|
934
|
+
debug$3("clone", name, _typeof(name), map);
|
|
940
935
|
var self = this;
|
|
941
936
|
if (typeof name == "function") {
|
|
942
937
|
map = name;
|
|
@@ -987,7 +982,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
987
982
|
});
|
|
988
983
|
return self;
|
|
989
984
|
} catch (err) {
|
|
990
|
-
debug("snap error", this, part, to, axis, delta, err);
|
|
985
|
+
debug$3("snap error", this, part, to, axis, delta, err);
|
|
991
986
|
throw error('group::snap error "'.concat(err.message || err.toString(), '"\nthis: ').concat(this, '\npart: "').concat(part, '"\nto: ').concat(to, '\naxis: "').concat(axis, '"\norientation: "').concat(orientation, '"\ndelta: "').concat(delta, '"\nstack: ').concat(err.stack, "\n"), "JSCAD_UTILS_GROUP_ERROR");
|
|
992
987
|
}
|
|
993
988
|
};
|
|
@@ -1002,7 +997,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1002
997
|
});
|
|
1003
998
|
return self;
|
|
1004
999
|
} catch (err) {
|
|
1005
|
-
debug("align error", this, part, to, axis, delta, err);
|
|
1000
|
+
debug$3("align error", this, part, to, axis, delta, err);
|
|
1006
1001
|
throw error('group::align error "'.concat(err.message || err.toString(), '"\nthis: ').concat(this, '\npart: "').concat(part, '"\nto: ').concat(to, '\naxis: "').concat(axis, '"\ndelta: "').concat(delta, '"\nstack: ').concat(err.stack, "\n"), "JSCAD_UTILS_GROUP_ERROR");
|
|
1007
1002
|
}
|
|
1008
1003
|
};
|
|
@@ -1018,7 +1013,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1018
1013
|
JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
|
|
1019
1014
|
var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
1020
1015
|
var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
1021
|
-
debug("connectTo", {
|
|
1016
|
+
debug$3("connectTo", {
|
|
1022
1017
|
partName,
|
|
1023
1018
|
connectorName,
|
|
1024
1019
|
to,
|
|
@@ -1030,12 +1025,12 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1030
1025
|
var myConnector = connectorName.split(".").reduce(function(a, v) {
|
|
1031
1026
|
return a[v];
|
|
1032
1027
|
}, self.parts[partName].properties);
|
|
1033
|
-
debug("toConnector", to instanceof CSG.Connector);
|
|
1028
|
+
debug$3("toConnector", to instanceof CSG.Connector);
|
|
1034
1029
|
var toConnector = toConnectorName.split(".").reduce(function(a, v) {
|
|
1035
1030
|
return a[v];
|
|
1036
1031
|
}, to.properties);
|
|
1037
1032
|
var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
|
|
1038
|
-
debug("connectTo", matrix);
|
|
1033
|
+
debug$3("connectTo", matrix);
|
|
1039
1034
|
self.map(function(part) {
|
|
1040
1035
|
return part.transform(matrix);
|
|
1041
1036
|
});
|
|
@@ -1055,7 +1050,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1055
1050
|
JsCadUtilsGroup.prototype.translate = function translate(x, y, z) {
|
|
1056
1051
|
var self = this;
|
|
1057
1052
|
var t = Array.isArray(x) ? x : [ x, y, z ];
|
|
1058
|
-
debug("translate", t);
|
|
1053
|
+
debug$3("translate", t);
|
|
1059
1054
|
self.map(function(part) {
|
|
1060
1055
|
return part.translate(t);
|
|
1061
1056
|
});
|
|
@@ -1079,7 +1074,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1079
1074
|
var a = [];
|
|
1080
1075
|
p.forEach(function(name) {
|
|
1081
1076
|
if (!self.parts[name]) {
|
|
1082
|
-
debug("array error", _this, parts);
|
|
1077
|
+
debug$3("array error", _this, parts);
|
|
1083
1078
|
throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
|
|
1084
1079
|
}
|
|
1085
1080
|
a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
|
|
@@ -1095,14 +1090,14 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1095
1090
|
});
|
|
1096
1091
|
};
|
|
1097
1092
|
JsCadUtilsGroup.prototype.toString = function() {
|
|
1098
|
-
return '{\n name: "'.concat(this.name, '",\n names: "').concat(this.names.join(","), '", \n parts: "').concat(Object.keys(this.parts), '",\n holes:
|
|
1093
|
+
return '{\n name: "'.concat(this.name, '",\n names: "').concat(this.names.join(","), '", \n parts: "').concat(Object.keys(this.parts), '",\n holes: ').concat(Array.isArray(this.holes) ? this.holes.length : this.holes ? 1 : 0, "\n}");
|
|
1099
1094
|
};
|
|
1100
1095
|
JsCadUtilsGroup.prototype.setName = function(name) {
|
|
1101
1096
|
this.name = name;
|
|
1102
1097
|
return this;
|
|
1103
1098
|
};
|
|
1104
1099
|
function Group(objectNames, addObjects) {
|
|
1105
|
-
debug("Group", objectNames, addObjects);
|
|
1100
|
+
debug$3("Group", objectNames, addObjects);
|
|
1106
1101
|
var self = {
|
|
1107
1102
|
name: "",
|
|
1108
1103
|
names: [],
|
|
@@ -1135,7 +1130,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1135
1130
|
}
|
|
1136
1131
|
return new JsCadUtilsGroup(self.names, self.parts, self.holes);
|
|
1137
1132
|
}
|
|
1138
|
-
var debug$
|
|
1133
|
+
var debug$2 = Debug("jscadUtils:util");
|
|
1139
1134
|
var NOZZEL_SIZE = .4;
|
|
1140
1135
|
var nearest = {
|
|
1141
1136
|
under: function under(desired) {
|
|
@@ -1170,7 +1165,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1170
1165
|
return ((n = +n) || 1 / n) < 0;
|
|
1171
1166
|
}
|
|
1172
1167
|
function print(msg, o) {
|
|
1173
|
-
debug$
|
|
1168
|
+
debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
|
|
1174
1169
|
}
|
|
1175
1170
|
function jscadToString(o) {
|
|
1176
1171
|
if (_typeof(o) == "object") {
|
|
@@ -1231,7 +1226,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1231
1226
|
});
|
|
1232
1227
|
}
|
|
1233
1228
|
function unitAxis(length, radius, centroid) {
|
|
1234
|
-
debug$
|
|
1229
|
+
debug$2("unitAxis", length, radius, centroid);
|
|
1235
1230
|
centroid = centroid || [ 0, 0, 0 ];
|
|
1236
1231
|
var unitaxis = unitCube(length, radius).setColor(1, 0, 0).union([ unitCube(length, radius).rotateY(90).setColor(0, 1, 0), unitCube(length, radius).rotateX(90).setColor(0, 0, 1) ]);
|
|
1237
1232
|
unitaxis.properties.origin = new CSG.Connector([ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ]);
|
|
@@ -1284,7 +1279,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1284
1279
|
}, []);
|
|
1285
1280
|
}
|
|
1286
1281
|
function divA(a, f) {
|
|
1287
|
-
return div(a, f);
|
|
1282
|
+
return div$1(a, f);
|
|
1288
1283
|
}
|
|
1289
1284
|
function divxyz(size, x, y, z) {
|
|
1290
1285
|
return {
|
|
@@ -1293,7 +1288,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1293
1288
|
z: size.z / z
|
|
1294
1289
|
};
|
|
1295
1290
|
}
|
|
1296
|
-
function div
|
|
1291
|
+
function div(size, d) {
|
|
1297
1292
|
return this.divxyz(size, d, d, d);
|
|
1298
1293
|
}
|
|
1299
1294
|
function mulxyz(size, x, y, z) {
|
|
@@ -1444,7 +1439,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1444
1439
|
}) : t;
|
|
1445
1440
|
}
|
|
1446
1441
|
function snap(moveobj, withobj, axis, orientation, delta) {
|
|
1447
|
-
debug$
|
|
1442
|
+
debug$2("snap", moveobj, withobj, axis, orientation, delta);
|
|
1448
1443
|
var t = calcSnap(moveobj, withobj, axis, orientation, delta);
|
|
1449
1444
|
return moveobj.translate(t);
|
|
1450
1445
|
}
|
|
@@ -1452,7 +1447,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1452
1447
|
return moveobj.translate(calcFlush(moveobj, withobj, axis, mside, wside));
|
|
1453
1448
|
}
|
|
1454
1449
|
function axisApply(axes, valfun, a) {
|
|
1455
|
-
debug$
|
|
1450
|
+
debug$2("axisApply", axes, valfun, a);
|
|
1456
1451
|
var retval = a || [ 0, 0, 0 ];
|
|
1457
1452
|
var lookup = {
|
|
1458
1453
|
x: 0,
|
|
@@ -1596,7 +1591,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1596
1591
|
}));
|
|
1597
1592
|
var theRotationAxis = rotationAxes[rotateaxis];
|
|
1598
1593
|
var cutplane = CSG.OrthoNormalBasis.GetCartesian(info.orthoNormalCartesian[0], info.orthoNormalCartesian[1]).translate(cutDelta).rotate(rotationCenter, theRotationAxis, angle);
|
|
1599
|
-
debug$
|
|
1594
|
+
debug$2("bisect", debug$2.enabled && {
|
|
1600
1595
|
axis,
|
|
1601
1596
|
offset,
|
|
1602
1597
|
angle,
|
|
@@ -1677,21 +1672,18 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1677
1672
|
return CSG.fromPolygons(polygons);
|
|
1678
1673
|
}
|
|
1679
1674
|
function slices2poly(slices, options, axis) {
|
|
1680
|
-
debug$
|
|
1675
|
+
debug$2("slices2poly", slices, options, axis);
|
|
1681
1676
|
options = Object.assign({
|
|
1682
1677
|
twistangle: 0,
|
|
1683
1678
|
twiststeps: 0
|
|
1684
1679
|
}, options);
|
|
1685
1680
|
var twistangle = options && parseFloat(options.twistangle) || 0;
|
|
1686
|
-
|
|
1687
|
-
if (twistangle == 0 || twiststeps < 1) {
|
|
1688
|
-
twiststeps = 1;
|
|
1689
|
-
}
|
|
1681
|
+
options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
|
|
1690
1682
|
var normalVector = options.si.normalVector;
|
|
1691
1683
|
var polygons = [];
|
|
1692
1684
|
var first$1 = first(slices);
|
|
1693
1685
|
var last$1 = last(slices);
|
|
1694
|
-
debug$
|
|
1686
|
+
debug$2("slices2poly first", first$1, first$1.offset, "last", last$1);
|
|
1695
1687
|
var up = first$1.offset[axis] > last$1.offset[axis];
|
|
1696
1688
|
polygons = polygons.concat(first$1.poly._toPlanePolygons({
|
|
1697
1689
|
translation: first$1.offset,
|
|
@@ -1777,7 +1769,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1777
1769
|
var b = object.getBounds();
|
|
1778
1770
|
var absoluteRadius = Math.abs(radius);
|
|
1779
1771
|
var si = sliceParams(orientation, radius, b);
|
|
1780
|
-
debug$
|
|
1772
|
+
debug$2("reShape", absoluteRadius, si);
|
|
1781
1773
|
if (si.axis !== "z") throw new Error('reShape error: CAG._toPlanePolytons only uses the "z" axis. You must use the "z" axis for now.');
|
|
1782
1774
|
var cutplane = CSG.OrthoNormalBasis.GetCartesian(si.orthoNormalCartesian[0], si.orthoNormalCartesian[1]).translate(si.cutDelta);
|
|
1783
1775
|
var slice = object.sectionCut(cutplane);
|
|
@@ -1788,7 +1780,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1788
1780
|
return si.positive ? absoluteRadius : 0;
|
|
1789
1781
|
});
|
|
1790
1782
|
var plane = si.positive ? cutplane.plane : cutplane.plane.flipped();
|
|
1791
|
-
debug$
|
|
1783
|
+
debug$2("reShape first/last", first, last);
|
|
1792
1784
|
var slices = slicer(first, last, slice, radius);
|
|
1793
1785
|
var delta = slices2poly(slices, Object.assign(options, {
|
|
1794
1786
|
si
|
|
@@ -1852,7 +1844,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1852
1844
|
function clone(o) {
|
|
1853
1845
|
var c = CSG.fromPolygons(o.toPolygons());
|
|
1854
1846
|
cloneProperties(o, c);
|
|
1855
|
-
debug$
|
|
1847
|
+
debug$2("clone", o, c, CSG);
|
|
1856
1848
|
return c;
|
|
1857
1849
|
}
|
|
1858
1850
|
function addConnector(object, name) {
|
|
@@ -1862,15 +1854,15 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1862
1854
|
object.properties[name] = new CSG.Connector(point, axis, normal);
|
|
1863
1855
|
return object;
|
|
1864
1856
|
}
|
|
1865
|
-
var debug$
|
|
1857
|
+
var debug$1 = Debug("jscadUtils:parts");
|
|
1866
1858
|
var parts = {
|
|
1867
|
-
BBox,
|
|
1859
|
+
BBox: BBox$1,
|
|
1868
1860
|
Cube,
|
|
1869
1861
|
RoundedCube,
|
|
1870
1862
|
Cylinder,
|
|
1871
1863
|
Cone
|
|
1872
1864
|
};
|
|
1873
|
-
function BBox() {
|
|
1865
|
+
function BBox$1() {
|
|
1874
1866
|
function box(object) {
|
|
1875
1867
|
return CSG.cube({
|
|
1876
1868
|
center: object.centroid(),
|
|
@@ -1886,7 +1878,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1886
1878
|
}, undefined);
|
|
1887
1879
|
}
|
|
1888
1880
|
function Cube(width) {
|
|
1889
|
-
var r = div(fromxyz(width), 2);
|
|
1881
|
+
var r = div$1(fromxyz(width), 2);
|
|
1890
1882
|
return CSG.cube({
|
|
1891
1883
|
center: r,
|
|
1892
1884
|
radius: r
|
|
@@ -1901,7 +1893,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1901
1893
|
} else {
|
|
1902
1894
|
var r = [ x / 2, y / 2 ];
|
|
1903
1895
|
}
|
|
1904
|
-
debug$
|
|
1896
|
+
debug$1("RoundedCube", size$1, r, thickness, corner_radius);
|
|
1905
1897
|
var roundedcube = CAG.roundedRectangle({
|
|
1906
1898
|
center: [ r[0], r[1], 0 ],
|
|
1907
1899
|
radius: r,
|
|
@@ -1914,7 +1906,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1914
1906
|
}
|
|
1915
1907
|
function Cylinder(diameter, height) {
|
|
1916
1908
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1917
|
-
debug$
|
|
1909
|
+
debug$1("parts.Cylinder", diameter, height, options);
|
|
1918
1910
|
options = Object.assign({
|
|
1919
1911
|
start: [ 0, 0, 0 ],
|
|
1920
1912
|
end: [ 0, 0, height ],
|
|
@@ -1925,7 +1917,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1925
1917
|
}
|
|
1926
1918
|
function Cone(diameter1, diameter2, height) {
|
|
1927
1919
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1928
|
-
debug$
|
|
1920
|
+
debug$1("parts.Cone", diameter1, diameter2, height, options);
|
|
1929
1921
|
return CSG.cylinder(Object.assign({
|
|
1930
1922
|
start: [ 0, 0, 0 ],
|
|
1931
1923
|
end: [ 0, 0, height ],
|
|
@@ -1935,7 +1927,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1935
1927
|
}, options));
|
|
1936
1928
|
}
|
|
1937
1929
|
function Hexagon(diameter, height) {
|
|
1938
|
-
debug$
|
|
1930
|
+
debug$1("hexagon", diameter, height);
|
|
1939
1931
|
var radius = diameter / 2;
|
|
1940
1932
|
var sqrt3 = Math.sqrt(3) / 2;
|
|
1941
1933
|
var hex = CAG.fromPoints([ [ radius, 0 ], [ radius / 2, radius * sqrt3 ], [ -radius / 2, radius * sqrt3 ], [ -radius, 0 ], [ -radius / 2, -radius * sqrt3 ], [ radius / 2, -radius * sqrt3 ] ]);
|
|
@@ -2033,7 +2025,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2033
2025
|
var parts$1 = Object.freeze({
|
|
2034
2026
|
__proto__: null,
|
|
2035
2027
|
default: parts,
|
|
2036
|
-
BBox,
|
|
2028
|
+
BBox: BBox$1,
|
|
2037
2029
|
Cube,
|
|
2038
2030
|
RoundedCube,
|
|
2039
2031
|
Cylinder,
|
|
@@ -2045,13 +2037,13 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2045
2037
|
Board,
|
|
2046
2038
|
Hardware
|
|
2047
2039
|
});
|
|
2048
|
-
var debug
|
|
2040
|
+
var debug = Debug("jscadUtils:boxes");
|
|
2049
2041
|
function RabbetJoin(box, thickness, cutHeight) {
|
|
2050
2042
|
depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
|
|
2051
2043
|
return rabbetJoin(box, thickness, cutHeight);
|
|
2052
2044
|
}
|
|
2053
2045
|
function topMiddleBottom(box, thickness) {
|
|
2054
|
-
debug
|
|
2046
|
+
debug("TopMiddleBottom", box, thickness);
|
|
2055
2047
|
var bottom = box.bisect("z", thickness, {
|
|
2056
2048
|
color: true
|
|
2057
2049
|
});
|
|
@@ -2060,11 +2052,11 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2060
2052
|
}
|
|
2061
2053
|
function Rabett(box, thickness, gap, height, face) {
|
|
2062
2054
|
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
2063
|
-
debug
|
|
2055
|
+
debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
|
|
2064
2056
|
gap = gap || .25;
|
|
2065
2057
|
var inside = thickness - gap;
|
|
2066
2058
|
var outside = -thickness + gap;
|
|
2067
|
-
debug
|
|
2059
|
+
debug("inside", inside, "outside", outside);
|
|
2068
2060
|
var group = Group();
|
|
2069
2061
|
var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
|
|
2070
2062
|
var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
|
|
@@ -2086,7 +2078,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2086
2078
|
topWidth: -thickness,
|
|
2087
2079
|
bottomWidth: thickness
|
|
2088
2080
|
}, options);
|
|
2089
|
-
debug
|
|
2081
|
+
debug("RabettTopBottom", box, thickness, gap, options);
|
|
2090
2082
|
var group = Group("", {
|
|
2091
2083
|
box
|
|
2092
2084
|
});
|
|
@@ -2132,7 +2124,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2132
2124
|
};
|
|
2133
2125
|
var Rectangle = function Rectangle(size, thickness, cb) {
|
|
2134
2126
|
thickness = thickness || 2;
|
|
2135
|
-
var s = div(xyz2array(size), 2);
|
|
2127
|
+
var s = div$1(xyz2array(size), 2);
|
|
2136
2128
|
var r = add(s, thickness);
|
|
2137
2129
|
var box = CSG.cube({
|
|
2138
2130
|
center: r,
|
|
@@ -2152,16 +2144,16 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2152
2144
|
if (exteriorcb) box = exteriorcb(box);
|
|
2153
2145
|
return box;
|
|
2154
2146
|
};
|
|
2155
|
-
var BBox
|
|
2147
|
+
var BBox = function BBox(o) {
|
|
2156
2148
|
depreciated("BBox", true, "Use 'parts.BBox' instead");
|
|
2157
|
-
var s = div(xyz2array(o.size()), 2);
|
|
2149
|
+
var s = div$1(xyz2array(o.size()), 2);
|
|
2158
2150
|
return CSG.cube({
|
|
2159
2151
|
center: s,
|
|
2160
2152
|
radius: s
|
|
2161
2153
|
}).align(o, "xyz");
|
|
2162
2154
|
};
|
|
2163
2155
|
function getRadius(o) {
|
|
2164
|
-
return div(xyz2array(o.size()), 2);
|
|
2156
|
+
return div$1(xyz2array(o.size()), 2);
|
|
2165
2157
|
}
|
|
2166
2158
|
function rabbetJoin(box, thickness) {
|
|
2167
2159
|
var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
|
|
@@ -2189,7 +2181,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2189
2181
|
CutOut,
|
|
2190
2182
|
Rectangle,
|
|
2191
2183
|
Hollow,
|
|
2192
|
-
BBox
|
|
2184
|
+
BBox
|
|
2193
2185
|
});
|
|
2194
2186
|
var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
|
|
2195
2187
|
group: Group,
|
|
@@ -2209,6 +2201,9 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2209
2201
|
exports.parts = parts$1;
|
|
2210
2202
|
exports.triUtils = triUtils;
|
|
2211
2203
|
exports.util = util;
|
|
2204
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2205
|
+
value: true
|
|
2206
|
+
});
|
|
2212
2207
|
return exports;
|
|
2213
2208
|
}({}, jsCadCSG, scadApi);
|
|
2214
2209
|
const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
|