@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
|
@@ -142,7 +142,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
142
142
|
return divxyz;
|
|
143
143
|
},
|
|
144
144
|
get div() {
|
|
145
|
-
return div
|
|
145
|
+
return div;
|
|
146
146
|
},
|
|
147
147
|
get mulxyz() {
|
|
148
148
|
return mulxyz;
|
|
@@ -274,104 +274,98 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
274
274
|
return addConnector;
|
|
275
275
|
}
|
|
276
276
|
});
|
|
277
|
-
function
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return typeof obj;
|
|
282
|
-
};
|
|
283
|
-
} else {
|
|
284
|
-
_typeof = function(obj) {
|
|
285
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
return _typeof(obj);
|
|
289
|
-
}
|
|
290
|
-
function _defineProperty(obj, key, value) {
|
|
291
|
-
if (key in obj) {
|
|
292
|
-
Object.defineProperty(obj, key, {
|
|
293
|
-
value,
|
|
294
|
-
enumerable: true,
|
|
295
|
-
configurable: true,
|
|
296
|
-
writable: true
|
|
297
|
-
});
|
|
298
|
-
} else {
|
|
299
|
-
obj[key] = value;
|
|
300
|
-
}
|
|
301
|
-
return obj;
|
|
277
|
+
function _arrayLikeToArray(r, a) {
|
|
278
|
+
(null == a || a > r.length) && (a = r.length);
|
|
279
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
280
|
+
return n;
|
|
302
281
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
function
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
282
|
+
function _arrayWithHoles(r) {
|
|
283
|
+
if (Array.isArray(r)) return r;
|
|
284
|
+
}
|
|
285
|
+
function _defineProperty(e, r, t) {
|
|
286
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
287
|
+
value: t,
|
|
288
|
+
enumerable: !0,
|
|
289
|
+
configurable: !0,
|
|
290
|
+
writable: !0
|
|
291
|
+
}) : e[r] = t, e;
|
|
292
|
+
}
|
|
293
|
+
function _iterableToArrayLimit(r, l) {
|
|
294
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
295
|
+
if (null != t) {
|
|
296
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
297
|
+
try {
|
|
298
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
299
|
+
if (Object(t) !== t) return;
|
|
300
|
+
f = !1;
|
|
301
|
+
} else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
|
|
302
|
+
} catch (r) {
|
|
303
|
+
o = !0, n = r;
|
|
304
|
+
} finally {
|
|
305
|
+
try {
|
|
306
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
307
|
+
} finally {
|
|
308
|
+
if (o) throw n;
|
|
309
|
+
}
|
|
327
310
|
}
|
|
311
|
+
return a;
|
|
328
312
|
}
|
|
329
|
-
return target;
|
|
330
313
|
}
|
|
331
|
-
function
|
|
332
|
-
|
|
314
|
+
function _nonIterableRest() {
|
|
315
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
333
316
|
}
|
|
334
|
-
function
|
|
335
|
-
|
|
317
|
+
function ownKeys(e, r) {
|
|
318
|
+
var t = Object.keys(e);
|
|
319
|
+
if (Object.getOwnPropertySymbols) {
|
|
320
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
321
|
+
r && (o = o.filter(function(r) {
|
|
322
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
323
|
+
})), t.push.apply(t, o);
|
|
324
|
+
}
|
|
325
|
+
return t;
|
|
336
326
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
327
|
+
function _objectSpread2(e) {
|
|
328
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
329
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
330
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
331
|
+
_defineProperty(e, r, t[r]);
|
|
332
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
333
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
return e;
|
|
337
|
+
}
|
|
338
|
+
function _slicedToArray(r, e) {
|
|
339
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
340
|
+
}
|
|
341
|
+
function _toPrimitive(t, r) {
|
|
342
|
+
if ("object" != typeof t || !t) return t;
|
|
343
|
+
var e = t[Symbol.toPrimitive];
|
|
344
|
+
if (void 0 !== e) {
|
|
345
|
+
var i = e.call(t, r || "default");
|
|
346
|
+
if ("object" != typeof i) return i;
|
|
347
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
357
348
|
}
|
|
358
|
-
return
|
|
349
|
+
return ("string" === r ? String : Number)(t);
|
|
359
350
|
}
|
|
360
|
-
function
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
364
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
365
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
366
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
351
|
+
function _toPropertyKey(t) {
|
|
352
|
+
var i = _toPrimitive(t, "string");
|
|
353
|
+
return "symbol" == typeof i ? i : i + "";
|
|
367
354
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
355
|
+
function _typeof(o) {
|
|
356
|
+
"@babel/helpers - typeof";
|
|
357
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
358
|
+
return typeof o;
|
|
359
|
+
} : function(o) {
|
|
360
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
361
|
+
}, _typeof(o);
|
|
372
362
|
}
|
|
373
|
-
function
|
|
374
|
-
|
|
363
|
+
function _unsupportedIterableToArray(r, a) {
|
|
364
|
+
if (r) {
|
|
365
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
366
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
367
|
+
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;
|
|
368
|
+
}
|
|
375
369
|
}
|
|
376
370
|
var toRadians = function toRadians(deg) {
|
|
377
371
|
return deg / 180 * Math.PI;
|
|
@@ -431,7 +425,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
431
425
|
solve90ac,
|
|
432
426
|
solveab
|
|
433
427
|
});
|
|
434
|
-
var div = function div(a, f) {
|
|
428
|
+
var div$1 = function div(a, f) {
|
|
435
429
|
return a.map(function(e) {
|
|
436
430
|
return e / f;
|
|
437
431
|
});
|
|
@@ -486,7 +480,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
486
480
|
};
|
|
487
481
|
var array = Object.freeze({
|
|
488
482
|
__proto__: null,
|
|
489
|
-
div,
|
|
483
|
+
div: div$1,
|
|
490
484
|
addValue,
|
|
491
485
|
addArray,
|
|
492
486
|
add,
|
|
@@ -836,7 +830,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
836
830
|
var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
|
|
837
831
|
var union = scadApi__default["default"].booleanOps.union;
|
|
838
832
|
init(CSG);
|
|
839
|
-
var debug = Debug("jscadUtils:group");
|
|
833
|
+
var debug$3 = Debug("jscadUtils:group");
|
|
840
834
|
function JsCadUtilsGroup() {
|
|
841
835
|
var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
842
836
|
var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -847,7 +841,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
847
841
|
this.holes = holes;
|
|
848
842
|
}
|
|
849
843
|
JsCadUtilsGroup.prototype.add = function(object, name, hidden, subparts, parts) {
|
|
850
|
-
debug("add", object, name, hidden, subparts, parts);
|
|
844
|
+
debug$3("add", object, name, hidden, subparts, parts);
|
|
851
845
|
var self = this;
|
|
852
846
|
if (object.parts) {
|
|
853
847
|
if (name) {
|
|
@@ -882,13 +876,14 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
882
876
|
if (pieces.length === 0) {
|
|
883
877
|
throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
|
|
884
878
|
}
|
|
885
|
-
debug("combine", self.names, self.parts);
|
|
879
|
+
debug$3("combine", self.names, self.parts);
|
|
886
880
|
var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
|
|
881
|
+
debug$3("combine mapPick", value, key, object);
|
|
887
882
|
return map ? map(value, key, index, object) : identity(value);
|
|
888
883
|
}, self.name));
|
|
889
884
|
return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
|
|
890
885
|
} catch (err) {
|
|
891
|
-
debug("combine error", this, pieces, options, err);
|
|
886
|
+
debug$3("combine error", this, pieces, options, err);
|
|
892
887
|
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");
|
|
893
888
|
}
|
|
894
889
|
};
|
|
@@ -912,7 +907,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
912
907
|
return self;
|
|
913
908
|
};
|
|
914
909
|
JsCadUtilsGroup.prototype.clone = function(name, map) {
|
|
915
|
-
debug("clone", name, _typeof(name), map);
|
|
910
|
+
debug$3("clone", name, _typeof(name), map);
|
|
916
911
|
var self = this;
|
|
917
912
|
if (typeof name == "function") {
|
|
918
913
|
map = name;
|
|
@@ -963,7 +958,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
963
958
|
});
|
|
964
959
|
return self;
|
|
965
960
|
} catch (err) {
|
|
966
|
-
debug("snap error", this, part, to, axis, delta, err);
|
|
961
|
+
debug$3("snap error", this, part, to, axis, delta, err);
|
|
967
962
|
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");
|
|
968
963
|
}
|
|
969
964
|
};
|
|
@@ -978,7 +973,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
978
973
|
});
|
|
979
974
|
return self;
|
|
980
975
|
} catch (err) {
|
|
981
|
-
debug("align error", this, part, to, axis, delta, err);
|
|
976
|
+
debug$3("align error", this, part, to, axis, delta, err);
|
|
982
977
|
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");
|
|
983
978
|
}
|
|
984
979
|
};
|
|
@@ -994,7 +989,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
994
989
|
JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
|
|
995
990
|
var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
996
991
|
var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
997
|
-
debug("connectTo", {
|
|
992
|
+
debug$3("connectTo", {
|
|
998
993
|
partName,
|
|
999
994
|
connectorName,
|
|
1000
995
|
to,
|
|
@@ -1006,12 +1001,12 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1006
1001
|
var myConnector = connectorName.split(".").reduce(function(a, v) {
|
|
1007
1002
|
return a[v];
|
|
1008
1003
|
}, self.parts[partName].properties);
|
|
1009
|
-
debug("toConnector", to instanceof CSG.Connector);
|
|
1004
|
+
debug$3("toConnector", to instanceof CSG.Connector);
|
|
1010
1005
|
var toConnector = toConnectorName.split(".").reduce(function(a, v) {
|
|
1011
1006
|
return a[v];
|
|
1012
1007
|
}, to.properties);
|
|
1013
1008
|
var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
|
|
1014
|
-
debug("connectTo", matrix);
|
|
1009
|
+
debug$3("connectTo", matrix);
|
|
1015
1010
|
self.map(function(part) {
|
|
1016
1011
|
return part.transform(matrix);
|
|
1017
1012
|
});
|
|
@@ -1031,7 +1026,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1031
1026
|
JsCadUtilsGroup.prototype.translate = function translate(x, y, z) {
|
|
1032
1027
|
var self = this;
|
|
1033
1028
|
var t = Array.isArray(x) ? x : [ x, y, z ];
|
|
1034
|
-
debug("translate", t);
|
|
1029
|
+
debug$3("translate", t);
|
|
1035
1030
|
self.map(function(part) {
|
|
1036
1031
|
return part.translate(t);
|
|
1037
1032
|
});
|
|
@@ -1055,7 +1050,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1055
1050
|
var a = [];
|
|
1056
1051
|
p.forEach(function(name) {
|
|
1057
1052
|
if (!self.parts[name]) {
|
|
1058
|
-
debug("array error", _this, parts);
|
|
1053
|
+
debug$3("array error", _this, parts);
|
|
1059
1054
|
throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
|
|
1060
1055
|
}
|
|
1061
1056
|
a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
|
|
@@ -1071,14 +1066,14 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1071
1066
|
});
|
|
1072
1067
|
};
|
|
1073
1068
|
JsCadUtilsGroup.prototype.toString = function() {
|
|
1074
|
-
return '{\n name: "'.concat(this.name, '",\n names: "').concat(this.names.join(","), '", \n parts: "').concat(Object.keys(this.parts), '",\n holes:
|
|
1069
|
+
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}");
|
|
1075
1070
|
};
|
|
1076
1071
|
JsCadUtilsGroup.prototype.setName = function(name) {
|
|
1077
1072
|
this.name = name;
|
|
1078
1073
|
return this;
|
|
1079
1074
|
};
|
|
1080
1075
|
function Group(objectNames, addObjects) {
|
|
1081
|
-
debug("Group", objectNames, addObjects);
|
|
1076
|
+
debug$3("Group", objectNames, addObjects);
|
|
1082
1077
|
var self = {
|
|
1083
1078
|
name: "",
|
|
1084
1079
|
names: [],
|
|
@@ -1111,7 +1106,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1111
1106
|
}
|
|
1112
1107
|
return new JsCadUtilsGroup(self.names, self.parts, self.holes);
|
|
1113
1108
|
}
|
|
1114
|
-
var debug$
|
|
1109
|
+
var debug$2 = Debug("jscadUtils:util");
|
|
1115
1110
|
var NOZZEL_SIZE = .4;
|
|
1116
1111
|
var nearest = {
|
|
1117
1112
|
under: function under(desired) {
|
|
@@ -1146,7 +1141,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1146
1141
|
return ((n = +n) || 1 / n) < 0;
|
|
1147
1142
|
}
|
|
1148
1143
|
function print(msg, o) {
|
|
1149
|
-
debug$
|
|
1144
|
+
debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
|
|
1150
1145
|
}
|
|
1151
1146
|
function jscadToString(o) {
|
|
1152
1147
|
if (_typeof(o) == "object") {
|
|
@@ -1207,7 +1202,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1207
1202
|
});
|
|
1208
1203
|
}
|
|
1209
1204
|
function unitAxis(length, radius, centroid) {
|
|
1210
|
-
debug$
|
|
1205
|
+
debug$2("unitAxis", length, radius, centroid);
|
|
1211
1206
|
centroid = centroid || [ 0, 0, 0 ];
|
|
1212
1207
|
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) ]);
|
|
1213
1208
|
unitaxis.properties.origin = new CSG.Connector([ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ]);
|
|
@@ -1260,7 +1255,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1260
1255
|
}, []);
|
|
1261
1256
|
}
|
|
1262
1257
|
function divA(a, f) {
|
|
1263
|
-
return div(a, f);
|
|
1258
|
+
return div$1(a, f);
|
|
1264
1259
|
}
|
|
1265
1260
|
function divxyz(size, x, y, z) {
|
|
1266
1261
|
return {
|
|
@@ -1269,7 +1264,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1269
1264
|
z: size.z / z
|
|
1270
1265
|
};
|
|
1271
1266
|
}
|
|
1272
|
-
function div
|
|
1267
|
+
function div(size, d) {
|
|
1273
1268
|
return this.divxyz(size, d, d, d);
|
|
1274
1269
|
}
|
|
1275
1270
|
function mulxyz(size, x, y, z) {
|
|
@@ -1420,7 +1415,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1420
1415
|
}) : t;
|
|
1421
1416
|
}
|
|
1422
1417
|
function snap(moveobj, withobj, axis, orientation, delta) {
|
|
1423
|
-
debug$
|
|
1418
|
+
debug$2("snap", moveobj, withobj, axis, orientation, delta);
|
|
1424
1419
|
var t = calcSnap(moveobj, withobj, axis, orientation, delta);
|
|
1425
1420
|
return moveobj.translate(t);
|
|
1426
1421
|
}
|
|
@@ -1428,7 +1423,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1428
1423
|
return moveobj.translate(calcFlush(moveobj, withobj, axis, mside, wside));
|
|
1429
1424
|
}
|
|
1430
1425
|
function axisApply(axes, valfun, a) {
|
|
1431
|
-
debug$
|
|
1426
|
+
debug$2("axisApply", axes, valfun, a);
|
|
1432
1427
|
var retval = a || [ 0, 0, 0 ];
|
|
1433
1428
|
var lookup = {
|
|
1434
1429
|
x: 0,
|
|
@@ -1572,7 +1567,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1572
1567
|
}));
|
|
1573
1568
|
var theRotationAxis = rotationAxes[rotateaxis];
|
|
1574
1569
|
var cutplane = CSG.OrthoNormalBasis.GetCartesian(info.orthoNormalCartesian[0], info.orthoNormalCartesian[1]).translate(cutDelta).rotate(rotationCenter, theRotationAxis, angle);
|
|
1575
|
-
debug$
|
|
1570
|
+
debug$2("bisect", debug$2.enabled && {
|
|
1576
1571
|
axis,
|
|
1577
1572
|
offset,
|
|
1578
1573
|
angle,
|
|
@@ -1653,21 +1648,18 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1653
1648
|
return CSG.fromPolygons(polygons);
|
|
1654
1649
|
}
|
|
1655
1650
|
function slices2poly(slices, options, axis) {
|
|
1656
|
-
debug$
|
|
1651
|
+
debug$2("slices2poly", slices, options, axis);
|
|
1657
1652
|
options = Object.assign({
|
|
1658
1653
|
twistangle: 0,
|
|
1659
1654
|
twiststeps: 0
|
|
1660
1655
|
}, options);
|
|
1661
1656
|
var twistangle = options && parseFloat(options.twistangle) || 0;
|
|
1662
|
-
|
|
1663
|
-
if (twistangle == 0 || twiststeps < 1) {
|
|
1664
|
-
twiststeps = 1;
|
|
1665
|
-
}
|
|
1657
|
+
options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
|
|
1666
1658
|
var normalVector = options.si.normalVector;
|
|
1667
1659
|
var polygons = [];
|
|
1668
1660
|
var first$1 = first(slices);
|
|
1669
1661
|
var last$1 = last(slices);
|
|
1670
|
-
debug$
|
|
1662
|
+
debug$2("slices2poly first", first$1, first$1.offset, "last", last$1);
|
|
1671
1663
|
var up = first$1.offset[axis] > last$1.offset[axis];
|
|
1672
1664
|
polygons = polygons.concat(first$1.poly._toPlanePolygons({
|
|
1673
1665
|
translation: first$1.offset,
|
|
@@ -1753,7 +1745,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1753
1745
|
var b = object.getBounds();
|
|
1754
1746
|
var absoluteRadius = Math.abs(radius);
|
|
1755
1747
|
var si = sliceParams(orientation, radius, b);
|
|
1756
|
-
debug$
|
|
1748
|
+
debug$2("reShape", absoluteRadius, si);
|
|
1757
1749
|
if (si.axis !== "z") throw new Error('reShape error: CAG._toPlanePolytons only uses the "z" axis. You must use the "z" axis for now.');
|
|
1758
1750
|
var cutplane = CSG.OrthoNormalBasis.GetCartesian(si.orthoNormalCartesian[0], si.orthoNormalCartesian[1]).translate(si.cutDelta);
|
|
1759
1751
|
var slice = object.sectionCut(cutplane);
|
|
@@ -1764,7 +1756,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1764
1756
|
return si.positive ? absoluteRadius : 0;
|
|
1765
1757
|
});
|
|
1766
1758
|
var plane = si.positive ? cutplane.plane : cutplane.plane.flipped();
|
|
1767
|
-
debug$
|
|
1759
|
+
debug$2("reShape first/last", first, last);
|
|
1768
1760
|
var slices = slicer(first, last, slice, radius);
|
|
1769
1761
|
var delta = slices2poly(slices, Object.assign(options, {
|
|
1770
1762
|
si
|
|
@@ -1828,7 +1820,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1828
1820
|
function clone(o) {
|
|
1829
1821
|
var c = CSG.fromPolygons(o.toPolygons());
|
|
1830
1822
|
cloneProperties(o, c);
|
|
1831
|
-
debug$
|
|
1823
|
+
debug$2("clone", o, c, CSG);
|
|
1832
1824
|
return c;
|
|
1833
1825
|
}
|
|
1834
1826
|
function addConnector(object, name) {
|
|
@@ -1838,15 +1830,15 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1838
1830
|
object.properties[name] = new CSG.Connector(point, axis, normal);
|
|
1839
1831
|
return object;
|
|
1840
1832
|
}
|
|
1841
|
-
var debug$
|
|
1833
|
+
var debug$1 = Debug("jscadUtils:parts");
|
|
1842
1834
|
var parts = {
|
|
1843
|
-
BBox,
|
|
1835
|
+
BBox: BBox$1,
|
|
1844
1836
|
Cube,
|
|
1845
1837
|
RoundedCube,
|
|
1846
1838
|
Cylinder,
|
|
1847
1839
|
Cone
|
|
1848
1840
|
};
|
|
1849
|
-
function BBox() {
|
|
1841
|
+
function BBox$1() {
|
|
1850
1842
|
function box(object) {
|
|
1851
1843
|
return CSG.cube({
|
|
1852
1844
|
center: object.centroid(),
|
|
@@ -1862,7 +1854,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1862
1854
|
}, undefined);
|
|
1863
1855
|
}
|
|
1864
1856
|
function Cube(width) {
|
|
1865
|
-
var r = div(fromxyz(width), 2);
|
|
1857
|
+
var r = div$1(fromxyz(width), 2);
|
|
1866
1858
|
return CSG.cube({
|
|
1867
1859
|
center: r,
|
|
1868
1860
|
radius: r
|
|
@@ -1877,7 +1869,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1877
1869
|
} else {
|
|
1878
1870
|
var r = [ x / 2, y / 2 ];
|
|
1879
1871
|
}
|
|
1880
|
-
debug$
|
|
1872
|
+
debug$1("RoundedCube", size$1, r, thickness, corner_radius);
|
|
1881
1873
|
var roundedcube = CAG.roundedRectangle({
|
|
1882
1874
|
center: [ r[0], r[1], 0 ],
|
|
1883
1875
|
radius: r,
|
|
@@ -1890,7 +1882,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1890
1882
|
}
|
|
1891
1883
|
function Cylinder(diameter, height) {
|
|
1892
1884
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1893
|
-
debug$
|
|
1885
|
+
debug$1("parts.Cylinder", diameter, height, options);
|
|
1894
1886
|
options = Object.assign({
|
|
1895
1887
|
start: [ 0, 0, 0 ],
|
|
1896
1888
|
end: [ 0, 0, height ],
|
|
@@ -1901,7 +1893,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1901
1893
|
}
|
|
1902
1894
|
function Cone(diameter1, diameter2, height) {
|
|
1903
1895
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1904
|
-
debug$
|
|
1896
|
+
debug$1("parts.Cone", diameter1, diameter2, height, options);
|
|
1905
1897
|
return CSG.cylinder(Object.assign({
|
|
1906
1898
|
start: [ 0, 0, 0 ],
|
|
1907
1899
|
end: [ 0, 0, height ],
|
|
@@ -1911,7 +1903,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
1911
1903
|
}, options));
|
|
1912
1904
|
}
|
|
1913
1905
|
function Hexagon(diameter, height) {
|
|
1914
|
-
debug$
|
|
1906
|
+
debug$1("hexagon", diameter, height);
|
|
1915
1907
|
var radius = diameter / 2;
|
|
1916
1908
|
var sqrt3 = Math.sqrt(3) / 2;
|
|
1917
1909
|
var hex = CAG.fromPoints([ [ radius, 0 ], [ radius / 2, radius * sqrt3 ], [ -radius / 2, radius * sqrt3 ], [ -radius, 0 ], [ -radius / 2, -radius * sqrt3 ], [ radius / 2, -radius * sqrt3 ] ]);
|
|
@@ -2009,7 +2001,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2009
2001
|
var parts$1 = Object.freeze({
|
|
2010
2002
|
__proto__: null,
|
|
2011
2003
|
default: parts,
|
|
2012
|
-
BBox,
|
|
2004
|
+
BBox: BBox$1,
|
|
2013
2005
|
Cube,
|
|
2014
2006
|
RoundedCube,
|
|
2015
2007
|
Cylinder,
|
|
@@ -2021,13 +2013,13 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2021
2013
|
Board,
|
|
2022
2014
|
Hardware
|
|
2023
2015
|
});
|
|
2024
|
-
var debug
|
|
2016
|
+
var debug = Debug("jscadUtils:boxes");
|
|
2025
2017
|
function RabbetJoin(box, thickness, cutHeight) {
|
|
2026
2018
|
depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
|
|
2027
2019
|
return rabbetJoin(box, thickness, cutHeight);
|
|
2028
2020
|
}
|
|
2029
2021
|
function topMiddleBottom(box, thickness) {
|
|
2030
|
-
debug
|
|
2022
|
+
debug("TopMiddleBottom", box, thickness);
|
|
2031
2023
|
var bottom = box.bisect("z", thickness, {
|
|
2032
2024
|
color: true
|
|
2033
2025
|
});
|
|
@@ -2036,11 +2028,11 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2036
2028
|
}
|
|
2037
2029
|
function Rabett(box, thickness, gap, height, face) {
|
|
2038
2030
|
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
2039
|
-
debug
|
|
2031
|
+
debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
|
|
2040
2032
|
gap = gap || .25;
|
|
2041
2033
|
var inside = thickness - gap;
|
|
2042
2034
|
var outside = -thickness + gap;
|
|
2043
|
-
debug
|
|
2035
|
+
debug("inside", inside, "outside", outside);
|
|
2044
2036
|
var group = Group();
|
|
2045
2037
|
var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
|
|
2046
2038
|
var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
|
|
@@ -2062,7 +2054,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2062
2054
|
topWidth: -thickness,
|
|
2063
2055
|
bottomWidth: thickness
|
|
2064
2056
|
}, options);
|
|
2065
|
-
debug
|
|
2057
|
+
debug("RabettTopBottom", box, thickness, gap, options);
|
|
2066
2058
|
var group = Group("", {
|
|
2067
2059
|
box
|
|
2068
2060
|
});
|
|
@@ -2108,7 +2100,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2108
2100
|
};
|
|
2109
2101
|
var Rectangle = function Rectangle(size, thickness, cb) {
|
|
2110
2102
|
thickness = thickness || 2;
|
|
2111
|
-
var s = div(xyz2array(size), 2);
|
|
2103
|
+
var s = div$1(xyz2array(size), 2);
|
|
2112
2104
|
var r = add(s, thickness);
|
|
2113
2105
|
var box = CSG.cube({
|
|
2114
2106
|
center: r,
|
|
@@ -2128,16 +2120,16 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2128
2120
|
if (exteriorcb) box = exteriorcb(box);
|
|
2129
2121
|
return box;
|
|
2130
2122
|
};
|
|
2131
|
-
var BBox
|
|
2123
|
+
var BBox = function BBox(o) {
|
|
2132
2124
|
depreciated("BBox", true, "Use 'parts.BBox' instead");
|
|
2133
|
-
var s = div(xyz2array(o.size()), 2);
|
|
2125
|
+
var s = div$1(xyz2array(o.size()), 2);
|
|
2134
2126
|
return CSG.cube({
|
|
2135
2127
|
center: s,
|
|
2136
2128
|
radius: s
|
|
2137
2129
|
}).align(o, "xyz");
|
|
2138
2130
|
};
|
|
2139
2131
|
function getRadius(o) {
|
|
2140
|
-
return div(xyz2array(o.size()), 2);
|
|
2132
|
+
return div$1(xyz2array(o.size()), 2);
|
|
2141
2133
|
}
|
|
2142
2134
|
function rabbetJoin(box, thickness) {
|
|
2143
2135
|
var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
|
|
@@ -2165,7 +2157,7 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2165
2157
|
CutOut,
|
|
2166
2158
|
Rectangle,
|
|
2167
2159
|
Hollow,
|
|
2168
|
-
BBox
|
|
2160
|
+
BBox
|
|
2169
2161
|
});
|
|
2170
2162
|
var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
|
|
2171
2163
|
group: Group,
|
|
@@ -2185,6 +2177,9 @@ function initJscadutils(_CSG, options = {}) {
|
|
|
2185
2177
|
exports.parts = parts$1;
|
|
2186
2178
|
exports.triUtils = triUtils;
|
|
2187
2179
|
exports.util = util;
|
|
2180
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2181
|
+
value: true
|
|
2182
|
+
});
|
|
2188
2183
|
return exports;
|
|
2189
2184
|
}({}, jsCadCSG, scadApi);
|
|
2190
2185
|
const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
|