@jwc/jscad-raspberrypi 3.1.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.
@@ -51,8 +51,13 @@ function initJscadutils(_CSG, options = {}) {
51
51
  });
52
52
  var jscadUtils = function(exports, jsCadCSG, scadApi) {
53
53
  "use strict";
54
- jsCadCSG = jsCadCSG && Object.prototype.hasOwnProperty.call(jsCadCSG, "default") ? jsCadCSG["default"] : jsCadCSG;
55
- scadApi = scadApi && Object.prototype.hasOwnProperty.call(scadApi, "default") ? scadApi["default"] : scadApi;
54
+ function _interopDefaultLegacy(e) {
55
+ return e && typeof e === "object" && "default" in e ? e : {
56
+ default: e
57
+ };
58
+ }
59
+ var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
60
+ var scadApi__default = _interopDefaultLegacy(scadApi);
56
61
  var util = Object.freeze({
57
62
  __proto__: null,
58
63
  get NOZZEL_SIZE() {
@@ -137,7 +142,7 @@ function initJscadutils(_CSG, options = {}) {
137
142
  return divxyz;
138
143
  },
139
144
  get div() {
140
- return div$1;
145
+ return div;
141
146
  },
142
147
  get mulxyz() {
143
148
  return mulxyz;
@@ -269,104 +274,98 @@ function initJscadutils(_CSG, options = {}) {
269
274
  return addConnector;
270
275
  }
271
276
  });
272
- function _typeof(obj) {
273
- "@babel/helpers - typeof";
274
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
275
- _typeof = function(obj) {
276
- return typeof obj;
277
- };
278
- } else {
279
- _typeof = function(obj) {
280
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
281
- };
282
- }
283
- return _typeof(obj);
284
- }
285
- function _defineProperty(obj, key, value) {
286
- if (key in obj) {
287
- Object.defineProperty(obj, key, {
288
- value,
289
- enumerable: true,
290
- configurable: true,
291
- writable: true
292
- });
293
- } else {
294
- obj[key] = value;
295
- }
296
- return obj;
297
- }
298
- function ownKeys(object, enumerableOnly) {
299
- var keys = Object.keys(object);
300
- if (Object.getOwnPropertySymbols) {
301
- var symbols = Object.getOwnPropertySymbols(object);
302
- if (enumerableOnly) symbols = symbols.filter((function(sym) {
303
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
304
- }));
305
- keys.push.apply(keys, symbols);
306
- }
307
- return keys;
308
- }
309
- function _objectSpread2(target) {
310
- for (var i = 1; i < arguments.length; i++) {
311
- var source = arguments[i] != null ? arguments[i] : {};
312
- if (i % 2) {
313
- ownKeys(Object(source), true).forEach((function(key) {
314
- _defineProperty(target, key, source[key]);
315
- }));
316
- } else if (Object.getOwnPropertyDescriptors) {
317
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
318
- } else {
319
- ownKeys(Object(source)).forEach((function(key) {
320
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
321
- }));
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;
281
+ }
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
+ }
322
310
  }
311
+ return a;
323
312
  }
324
- return target;
325
- }
326
- function _slicedToArray(arr, i) {
327
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
328
313
  }
329
- function _arrayWithHoles(arr) {
330
- if (Array.isArray(arr)) return arr;
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.");
331
316
  }
332
- function _iterableToArrayLimit(arr, i) {
333
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
334
- var _arr = [];
335
- var _n = true;
336
- var _d = false;
337
- var _e = undefined;
338
- try {
339
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
340
- _arr.push(_s.value);
341
- if (i && _arr.length === i) break;
342
- }
343
- } catch (err) {
344
- _d = true;
345
- _e = err;
346
- } finally {
347
- try {
348
- if (!_n && _i["return"] != null) _i["return"]();
349
- } finally {
350
- if (_d) throw _e;
351
- }
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);
352
324
  }
353
- return _arr;
325
+ return t;
354
326
  }
355
- function _unsupportedIterableToArray(o, minLen) {
356
- if (!o) return;
357
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
358
- var n = Object.prototype.toString.call(o).slice(8, -1);
359
- if (n === "Object" && o.constructor) n = o.constructor.name;
360
- if (n === "Map" || n === "Set") return Array.from(o);
361
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
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.");
348
+ }
349
+ return ("string" === r ? String : Number)(t);
362
350
  }
363
- function _arrayLikeToArray(arr, len) {
364
- if (len == null || len > arr.length) len = arr.length;
365
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
366
- return arr2;
351
+ function _toPropertyKey(t) {
352
+ var i = _toPrimitive(t, "string");
353
+ return "symbol" == typeof i ? i : i + "";
367
354
  }
368
- function _nonIterableRest() {
369
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
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);
362
+ }
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
+ }
370
369
  }
371
370
  var toRadians = function toRadians(deg) {
372
371
  return deg / 180 * Math.PI;
@@ -426,30 +425,30 @@ function initJscadutils(_CSG, options = {}) {
426
425
  solve90ac,
427
426
  solveab
428
427
  });
429
- var div = function div(a, f) {
430
- return a.map((function(e) {
428
+ var div$1 = function div(a, f) {
429
+ return a.map(function(e) {
431
430
  return e / f;
432
- }));
431
+ });
433
432
  };
434
433
  var addValue = function addValue(a, f) {
435
- return a.map((function(e) {
434
+ return a.map(function(e) {
436
435
  return e + f;
437
- }));
436
+ });
438
437
  };
439
438
  var addArray = function addArray(a, f) {
440
- return a.map((function(e, i) {
439
+ return a.map(function(e, i) {
441
440
  return e + f[i];
442
- }));
441
+ });
443
442
  };
444
443
  var add = function add(a) {
445
- return Array.prototype.slice.call(arguments, 1).reduce((function(result, arg) {
444
+ return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
446
445
  if (Array.isArray(arg)) {
447
446
  result = addArray(result, arg);
448
447
  } else {
449
448
  result = addValue(result, arg);
450
449
  }
451
450
  return result;
452
- }), a);
451
+ }, a);
453
452
  };
454
453
  var fromxyz = function fromxyz(object) {
455
454
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
@@ -468,9 +467,9 @@ function initJscadutils(_CSG, options = {}) {
468
467
  return a && a.length > 0 ? a[a.length - 1] : undefined;
469
468
  };
470
469
  var min = function min(a) {
471
- return a.reduce((function(result, value) {
470
+ return a.reduce(function(result, value) {
472
471
  return value < result ? value : result;
473
- }), Number.MAX_VALUE);
472
+ }, Number.MAX_VALUE);
474
473
  };
475
474
  var range = function range(a, b) {
476
475
  var result = [];
@@ -481,7 +480,7 @@ function initJscadutils(_CSG, options = {}) {
481
480
  };
482
481
  var array = Object.freeze({
483
482
  __proto__: null,
484
- div,
483
+ div: div$1,
485
484
  addValue,
486
485
  addArray,
487
486
  add,
@@ -504,11 +503,11 @@ function initJscadutils(_CSG, options = {}) {
504
503
  }
505
504
  }, jscadUtilsDebug || {});
506
505
  var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
507
- var enabled = checks.enabled.some((function checkEnabled(check) {
506
+ var enabled = checks.enabled.some(function checkEnabled(check) {
508
507
  return check.test(name);
509
- })) && !checks.disabled.some((function checkEnabled(check) {
508
+ }) && !checks.disabled.some(function checkEnabled(check) {
510
509
  return check.test(name);
511
- }));
510
+ });
512
511
  var logger = enabled ? checks.options.browser ? function() {
513
512
  var _console;
514
513
  for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -695,9 +694,9 @@ function initJscadutils(_CSG, options = {}) {
695
694
  function color(o, r, g, b, a) {
696
695
  if (typeof r !== "string") return o.setColor(r, g, b, a);
697
696
  if (r === "") return o;
698
- var c = name2rgb(r).map((function(x) {
697
+ var c = name2rgb(r).map(function(x) {
699
698
  return x / 255;
700
- }));
699
+ });
701
700
  c[3] = g || 1;
702
701
  return o.setColor(c);
703
702
  }
@@ -799,10 +798,10 @@ function initJscadutils(_CSG, options = {}) {
799
798
  if (arguments.length === 1) {
800
799
  return this._translate(arguments[0]);
801
800
  } else {
802
- var t = Array.prototype.slice.call(arguments, 0).reduce((function(result, arg) {
801
+ var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
803
802
  result = undefined(result, arg);
804
803
  return result;
805
- }), [ 0, 0, 0 ]);
804
+ }, [ 0, 0, 0 ]);
806
805
  return this._translate(t);
807
806
  }
808
807
  };
@@ -812,9 +811,9 @@ function initJscadutils(_CSG, options = {}) {
812
811
  proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
813
812
  var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
814
813
  var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
815
- var myConnector = myConnectorName.split(".").reduce((function(a, v) {
814
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
816
815
  return a[v];
817
- }), this.properties);
816
+ }, this.properties);
818
817
  if (!myConnector) {
819
818
  error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
820
819
  }
@@ -826,12 +825,12 @@ function initJscadutils(_CSG, options = {}) {
826
825
  __proto__: null,
827
826
  default: init
828
827
  });
829
- var CSG = jsCadCSG.CSG, CAG = jsCadCSG.CAG;
830
- var rectangular_extrude = scadApi.extrusions.rectangular_extrude;
831
- var _scadApi$text = scadApi.text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
832
- var union = scadApi.booleanOps.union;
828
+ var CSG = jsCadCSG__default["default"].CSG, CAG = jsCadCSG__default["default"].CAG;
829
+ var rectangular_extrude = scadApi__default["default"].extrusions.rectangular_extrude;
830
+ var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
831
+ var union = scadApi__default["default"].booleanOps.union;
833
832
  init(CSG);
834
- var debug = Debug("jscadUtils:group");
833
+ var debug$3 = Debug("jscadUtils:group");
835
834
  function JsCadUtilsGroup() {
836
835
  var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
837
836
  var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -842,16 +841,16 @@ function initJscadutils(_CSG, options = {}) {
842
841
  this.holes = holes;
843
842
  }
844
843
  JsCadUtilsGroup.prototype.add = function(object, name, hidden, subparts, parts) {
845
- debug("add", object, name, hidden, subparts, parts);
844
+ debug$3("add", object, name, hidden, subparts, parts);
846
845
  var self = this;
847
846
  if (object.parts) {
848
847
  if (name) {
849
848
  if (!hidden) self.names.push(name);
850
849
  self.parts[name] = object.combine(parts);
851
850
  if (subparts) {
852
- Object.keys(object.parts).forEach((function(key) {
851
+ Object.keys(object.parts).forEach(function(key) {
853
852
  self.parts[subparts + key] = object.parts[key];
854
- }));
853
+ });
855
854
  }
856
855
  } else {
857
856
  Object.assign(self.parts, object.parts);
@@ -877,29 +876,30 @@ function initJscadutils(_CSG, options = {}) {
877
876
  if (pieces.length === 0) {
878
877
  throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
879
878
  }
880
- debug("combine", self.names, self.parts);
881
- var g = union(mapPick(self.parts, pieces, (function(value, key, index, object) {
879
+ debug$3("combine", self.names, self.parts);
880
+ var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
881
+ debug$3("combine mapPick", value, key, object);
882
882
  return map ? map(value, key, index, object) : identity(value);
883
- }), self.name));
883
+ }, self.name));
884
884
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
885
885
  } catch (err) {
886
- debug("combine error", this, pieces, options, err);
886
+ debug$3("combine error", this, pieces, options, err);
887
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");
888
888
  }
889
889
  };
890
890
  JsCadUtilsGroup.prototype.map = function(cb) {
891
891
  var self = this;
892
- self.parts = Object.keys(self.parts).filter((function(k) {
892
+ self.parts = Object.keys(self.parts).filter(function(k) {
893
893
  return k !== "holes";
894
- })).reduce((function(result, key) {
894
+ }).reduce(function(result, key) {
895
895
  result[key] = cb(self.parts[key], key);
896
896
  return result;
897
- }), {});
897
+ }, {});
898
898
  if (self.holes) {
899
899
  if (Array.isArray(self.holes)) {
900
- self.holes = self.holes.map((function(hole, idx) {
900
+ self.holes = self.holes.map(function(hole, idx) {
901
901
  return cb(hole, idx);
902
- }));
902
+ });
903
903
  } else {
904
904
  self.holes = cb(self.holes, "holes");
905
905
  }
@@ -907,7 +907,7 @@ function initJscadutils(_CSG, options = {}) {
907
907
  return self;
908
908
  };
909
909
  JsCadUtilsGroup.prototype.clone = function(name, map) {
910
- debug("clone", name, _typeof(name), map);
910
+ debug$3("clone", name, _typeof(name), map);
911
911
  var self = this;
912
912
  if (typeof name == "function") {
913
913
  map = name;
@@ -915,15 +915,15 @@ function initJscadutils(_CSG, options = {}) {
915
915
  }
916
916
  if (!map) map = identity;
917
917
  var group = Group(name);
918
- Object.keys(self.parts).forEach((function(key) {
918
+ Object.keys(self.parts).forEach(function(key) {
919
919
  var part = self.parts[key];
920
920
  var hidden = self.names.indexOf(key) == -1;
921
921
  group.add(map(clone(part)), key, hidden);
922
- }));
922
+ });
923
923
  if (self.holes) {
924
- group.holes = toArray(self.holes).map((function(part) {
924
+ group.holes = toArray(self.holes).map(function(part) {
925
925
  return map(CSG.fromPolygons(part.toPolygons()), "holes");
926
- }));
926
+ });
927
927
  }
928
928
  return group;
929
929
  };
@@ -940,9 +940,9 @@ function initJscadutils(_CSG, options = {}) {
940
940
  }
941
941
  var rotationCenter = solid.centroid();
942
942
  var rotationAxis = axes[axis];
943
- self.map((function(part) {
943
+ self.map(function(part) {
944
944
  return part.rotate(rotationCenter, rotationAxis, angle);
945
- }));
945
+ });
946
946
  return self;
947
947
  };
948
948
  JsCadUtilsGroup.prototype.combineAll = function(options, map) {
@@ -953,12 +953,12 @@ function initJscadutils(_CSG, options = {}) {
953
953
  try {
954
954
  var self = this;
955
955
  var t = calcSnap(self.combine(part), to, axis, orientation, delta);
956
- self.map((function(part) {
956
+ self.map(function(part) {
957
957
  return part.translate(t);
958
- }));
958
+ });
959
959
  return self;
960
960
  } catch (err) {
961
- debug("snap error", this, part, to, axis, delta, err);
961
+ debug$3("snap error", this, part, to, axis, delta, err);
962
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");
963
963
  }
964
964
  };
@@ -968,12 +968,12 @@ function initJscadutils(_CSG, options = {}) {
968
968
  var t = calcCenterWith(self.combine(part, {
969
969
  noholes: true
970
970
  }), axis, to, delta);
971
- self.map((function(part) {
971
+ self.map(function(part) {
972
972
  return part.translate(t);
973
- }));
973
+ });
974
974
  return self;
975
975
  } catch (err) {
976
- debug("align error", this, part, to, axis, delta, err);
976
+ debug$3("align error", this, part, to, axis, delta, err);
977
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");
978
978
  }
979
979
  };
@@ -989,7 +989,7 @@ function initJscadutils(_CSG, options = {}) {
989
989
  JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
990
990
  var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
991
991
  var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
992
- debug("connectTo", {
992
+ debug$3("connectTo", {
993
993
  partName,
994
994
  connectorName,
995
995
  to,
@@ -998,38 +998,38 @@ function initJscadutils(_CSG, options = {}) {
998
998
  normalrotation
999
999
  });
1000
1000
  var self = this;
1001
- var myConnector = connectorName.split(".").reduce((function(a, v) {
1001
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1002
1002
  return a[v];
1003
- }), self.parts[partName].properties);
1004
- debug("toConnector", to instanceof CSG.Connector);
1005
- var toConnector = toConnectorName.split(".").reduce((function(a, v) {
1003
+ }, self.parts[partName].properties);
1004
+ debug$3("toConnector", to instanceof CSG.Connector);
1005
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1006
1006
  return a[v];
1007
- }), to.properties);
1007
+ }, to.properties);
1008
1008
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
1009
- debug("connectTo", matrix);
1010
- self.map((function(part) {
1009
+ debug$3("connectTo", matrix);
1010
+ self.map(function(part) {
1011
1011
  return part.transform(matrix);
1012
- }));
1012
+ });
1013
1013
  return self;
1014
1014
  };
1015
1015
  JsCadUtilsGroup.prototype.midlineTo = function midlineTo(part, axis, to) {
1016
1016
  var self = this;
1017
1017
  var size = self.combine(part).size();
1018
- var t = axisApply(axis, (function(i, a) {
1018
+ var t = axisApply(axis, function(i, a) {
1019
1019
  return to - size[a] / 2;
1020
- }));
1021
- self.map((function(part) {
1020
+ });
1021
+ self.map(function(part) {
1022
1022
  return part.translate(t);
1023
- }));
1023
+ });
1024
1024
  return self;
1025
1025
  };
1026
1026
  JsCadUtilsGroup.prototype.translate = function translate(x, y, z) {
1027
1027
  var self = this;
1028
1028
  var t = Array.isArray(x) ? x : [ x, y, z ];
1029
- debug("translate", t);
1030
- self.map((function(part) {
1029
+ debug$3("translate", t);
1030
+ self.map(function(part) {
1031
1031
  return part.translate(t);
1032
- }));
1032
+ });
1033
1033
  return self;
1034
1034
  };
1035
1035
  JsCadUtilsGroup.prototype.pick = function(parts, map) {
@@ -1037,9 +1037,9 @@ function initJscadutils(_CSG, options = {}) {
1037
1037
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1038
1038
  if (!map) map = identity;
1039
1039
  var g = Group();
1040
- p.forEach((function(name) {
1040
+ p.forEach(function(name) {
1041
1041
  g.add(map(CSG.fromPolygons(self.parts[name].toPolygons()), name), name);
1042
- }));
1042
+ });
1043
1043
  return g;
1044
1044
  };
1045
1045
  JsCadUtilsGroup.prototype.array = function(parts, map) {
@@ -1048,32 +1048,32 @@ function initJscadutils(_CSG, options = {}) {
1048
1048
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1049
1049
  if (!map) map = identity;
1050
1050
  var a = [];
1051
- p.forEach((function(name) {
1051
+ p.forEach(function(name) {
1052
1052
  if (!self.parts[name]) {
1053
- debug("array error", _this, parts);
1053
+ debug$3("array error", _this, parts);
1054
1054
  throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
1055
1055
  }
1056
1056
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
1057
- }));
1057
+ });
1058
1058
  return a;
1059
1059
  };
1060
1060
  JsCadUtilsGroup.prototype.toArray = function(pieces) {
1061
1061
  var self = this;
1062
1062
  var piecesArray = pieces ? pieces.split(",") : self.names;
1063
- return piecesArray.map((function(piece) {
1063
+ return piecesArray.map(function(piece) {
1064
1064
  if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
1065
1065
  return self.parts[piece];
1066
- }));
1066
+ });
1067
1067
  };
1068
1068
  JsCadUtilsGroup.prototype.toString = function() {
1069
- return '{\n name: "'.concat(this.name, '",\n names: "').concat(this.names.join(","), '", \n parts: "').concat(Object.keys(this.parts), '",\n holes: "').concat(this.holes, '"\n}');
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}");
1070
1070
  };
1071
1071
  JsCadUtilsGroup.prototype.setName = function(name) {
1072
1072
  this.name = name;
1073
1073
  return this;
1074
1074
  };
1075
1075
  function Group(objectNames, addObjects) {
1076
- debug("Group", objectNames, addObjects);
1076
+ debug$3("Group", objectNames, addObjects);
1077
1077
  var self = {
1078
1078
  name: "",
1079
1079
  names: [],
@@ -1096,9 +1096,9 @@ function initJscadutils(_CSG, options = {}) {
1096
1096
  self.name = objectNames;
1097
1097
  } else {
1098
1098
  var objects = objectNames;
1099
- self.names = Object.keys(objects).filter((function(k) {
1099
+ self.names = Object.keys(objects).filter(function(k) {
1100
1100
  return k !== "holes";
1101
- }));
1101
+ });
1102
1102
  self.parts = Object.assign({}, objects);
1103
1103
  self.holes = objects.holes;
1104
1104
  }
@@ -1106,7 +1106,7 @@ function initJscadutils(_CSG, options = {}) {
1106
1106
  }
1107
1107
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
1108
1108
  }
1109
- var debug$1 = Debug("jscadUtils:util");
1109
+ var debug$2 = Debug("jscadUtils:util");
1110
1110
  var NOZZEL_SIZE = .4;
1111
1111
  var nearest = {
1112
1112
  under: function under(desired) {
@@ -1141,7 +1141,7 @@ function initJscadutils(_CSG, options = {}) {
1141
1141
  return ((n = +n) || 1 / n) < 0;
1142
1142
  }
1143
1143
  function print(msg, o) {
1144
- debug$1(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1144
+ debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1145
1145
  }
1146
1146
  function jscadToString(o) {
1147
1147
  if (_typeof(o) == "object") {
@@ -1177,21 +1177,21 @@ function initJscadutils(_CSG, options = {}) {
1177
1177
  function label(text, x, y, width, height) {
1178
1178
  var l = vector_text(x || 0, y || 0, text);
1179
1179
  var o = [];
1180
- l.forEach((function(pl) {
1180
+ l.forEach(function(pl) {
1181
1181
  o.push(rectangular_extrude(pl, {
1182
1182
  w: width || 2,
1183
1183
  h: height || 2
1184
1184
  }));
1185
- }));
1185
+ });
1186
1186
  return center(union(o));
1187
1187
  }
1188
1188
  function text(text) {
1189
1189
  var l = vector_char(0, 0, text);
1190
- var _char = l.segments.reduce((function(result, segment) {
1190
+ var _char = l.segments.reduce(function(result, segment) {
1191
1191
  var path = new CSG.Path2D(segment);
1192
1192
  var cag = path.expandToCAG(2);
1193
1193
  return result ? result.union(cag) : cag;
1194
- }), undefined);
1194
+ }, undefined);
1195
1195
  return _char;
1196
1196
  }
1197
1197
  function unitCube(length, radius) {
@@ -1202,7 +1202,7 @@ function initJscadutils(_CSG, options = {}) {
1202
1202
  });
1203
1203
  }
1204
1204
  function unitAxis(length, radius, centroid) {
1205
- debug$1("unitAxis", length, radius, centroid);
1205
+ debug$2("unitAxis", length, radius, centroid);
1206
1206
  centroid = centroid || [ 0, 0, 0 ];
1207
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) ]);
1208
1208
  unitaxis.properties.origin = new CSG.Connector([ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ]);
@@ -1224,38 +1224,38 @@ function initJscadutils(_CSG, options = {}) {
1224
1224
  return result;
1225
1225
  }
1226
1226
  function zipObject(names, values) {
1227
- return names.reduce((function(result, value, idx) {
1227
+ return names.reduce(function(result, value, idx) {
1228
1228
  result[value] = values[idx];
1229
1229
  return result;
1230
- }), {});
1230
+ }, {});
1231
1231
  }
1232
1232
  function map(o, f) {
1233
- return Object.keys(o).map((function(key) {
1233
+ return Object.keys(o).map(function(key) {
1234
1234
  return f(o[key], key, o);
1235
- }));
1235
+ });
1236
1236
  }
1237
1237
  function mapValues(o, f) {
1238
- return Object.keys(o).map((function(key) {
1238
+ return Object.keys(o).map(function(key) {
1239
1239
  return f(o[key], key);
1240
- }));
1240
+ });
1241
1241
  }
1242
1242
  function pick(o, names) {
1243
- return names.reduce((function(result, name) {
1243
+ return names.reduce(function(result, name) {
1244
1244
  result[name] = o[name];
1245
1245
  return result;
1246
- }), {});
1246
+ }, {});
1247
1247
  }
1248
1248
  function mapPick(o, names, f, options) {
1249
- return names.reduce((function(result, name, index) {
1249
+ return names.reduce(function(result, name, index) {
1250
1250
  if (!o[name]) {
1251
1251
  throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
1252
1252
  }
1253
1253
  result.push(f ? f(o[name], name, index, o) : o[name]);
1254
1254
  return result;
1255
- }), []);
1255
+ }, []);
1256
1256
  }
1257
1257
  function divA(a, f) {
1258
- return div(a, f);
1258
+ return div$1(a, f);
1259
1259
  }
1260
1260
  function divxyz(size, x, y, z) {
1261
1261
  return {
@@ -1264,7 +1264,7 @@ function initJscadutils(_CSG, options = {}) {
1264
1264
  z: size.z / z
1265
1265
  };
1266
1266
  }
1267
- function div$1(size, d) {
1267
+ function div(size, d) {
1268
1268
  return this.divxyz(size, d, d, d);
1269
1269
  }
1270
1270
  function mulxyz(size, x, y, z) {
@@ -1316,9 +1316,9 @@ function initJscadutils(_CSG, options = {}) {
1316
1316
  var objectSize = size(object);
1317
1317
  var objectCentroid = centroid(object, objectSize);
1318
1318
  var idx = 0;
1319
- var t = map(objectSize, (function(i) {
1319
+ var t = map(objectSize, function(i) {
1320
1320
  return scale(i, a[idx++]);
1321
- }));
1321
+ });
1322
1322
  var new_object = object.scale(t);
1323
1323
  var new_centroid = centroid(new_object);
1324
1324
  var delta = new_centroid.minus(objectCentroid).times(-1);
@@ -1342,10 +1342,10 @@ function initJscadutils(_CSG, options = {}) {
1342
1342
  }
1343
1343
  var s = [ scale(objectSize.x, x), scale(objectSize.y, y), scale(objectSize.z, z) ];
1344
1344
  var min$1 = min(s);
1345
- return centerWith(object.scale(s.map((function(d, i) {
1345
+ return centerWith(object.scale(s.map(function(d, i) {
1346
1346
  if (a[i] === 0) return 1;
1347
1347
  return keep_aspect_ratio ? min$1 : d;
1348
- }))), "xyz", object);
1348
+ })), "xyz", object);
1349
1349
  }
1350
1350
  function shift(object, x, y, z) {
1351
1351
  var hsize = this.div(this.size(object.getBounds()), 2);
@@ -1384,9 +1384,9 @@ function initJscadutils(_CSG, options = {}) {
1384
1384
  if (side[0] === -1) {
1385
1385
  w[-1] = toxyz(withobj.centroid());
1386
1386
  }
1387
- return this.axisApply(axes, (function(i, axis) {
1387
+ return this.axisApply(axes, function(i, axis) {
1388
1388
  return w[side[0]][axis] - m[side[1]][axis];
1389
- }));
1389
+ });
1390
1390
  }
1391
1391
  function calcSnap(moveobj, withobj, axes, orientation) {
1392
1392
  var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
@@ -1407,15 +1407,15 @@ function initJscadutils(_CSG, options = {}) {
1407
1407
  if (side[0] === -1) {
1408
1408
  w[-1] = withobj.centroid();
1409
1409
  }
1410
- var t = axisApply(axes, (function(i, axis) {
1410
+ var t = axisApply(axes, function(i, axis) {
1411
1411
  return w[side[0]][axis] - m[side[1]][axis];
1412
- }));
1413
- return delta ? axisApply(axes, (function(i) {
1412
+ });
1413
+ return delta ? axisApply(axes, function(i) {
1414
1414
  return t[i] + delta;
1415
- })) : t;
1415
+ }) : t;
1416
1416
  }
1417
1417
  function snap(moveobj, withobj, axis, orientation, delta) {
1418
- debug$1("snap", moveobj, withobj, axis, orientation, delta);
1418
+ debug$2("snap", moveobj, withobj, axis, orientation, delta);
1419
1419
  var t = calcSnap(moveobj, withobj, axis, orientation, delta);
1420
1420
  return moveobj.translate(t);
1421
1421
  }
@@ -1423,16 +1423,16 @@ function initJscadutils(_CSG, options = {}) {
1423
1423
  return moveobj.translate(calcFlush(moveobj, withobj, axis, mside, wside));
1424
1424
  }
1425
1425
  function axisApply(axes, valfun, a) {
1426
- debug$1("axisApply", axes, valfun, a);
1426
+ debug$2("axisApply", axes, valfun, a);
1427
1427
  var retval = a || [ 0, 0, 0 ];
1428
1428
  var lookup = {
1429
1429
  x: 0,
1430
1430
  y: 1,
1431
1431
  z: 2
1432
1432
  };
1433
- axes.split("").forEach((function(axis) {
1433
+ axes.split("").forEach(function(axis) {
1434
1434
  retval[lookup[axis]] = valfun(lookup[axis], axis);
1435
- }));
1435
+ });
1436
1436
  return retval;
1437
1437
  }
1438
1438
  function axis2array(axes, valfun) {
@@ -1443,10 +1443,10 @@ function initJscadutils(_CSG, options = {}) {
1443
1443
  y: 1,
1444
1444
  z: 2
1445
1445
  };
1446
- axes.split("").forEach((function(axis) {
1446
+ axes.split("").forEach(function(axis) {
1447
1447
  var i = lookup[axis];
1448
1448
  a[i] = valfun(i, axis);
1449
- }));
1449
+ });
1450
1450
  return a;
1451
1451
  }
1452
1452
  function centroid(o, objectSize) {
@@ -1461,9 +1461,9 @@ function initJscadutils(_CSG, options = {}) {
1461
1461
  function calcmidlineTo(o, axis, to) {
1462
1462
  var bounds = o.getBounds();
1463
1463
  var objectSize = size(bounds);
1464
- return axisApply(axis, (function(i, a) {
1464
+ return axisApply(axis, function(i, a) {
1465
1465
  return to - objectSize[a] / 2;
1466
- }));
1466
+ });
1467
1467
  }
1468
1468
  function midlineTo(o, axis, to) {
1469
1469
  return o.translate(calcmidlineTo(o, axis, to));
@@ -1471,18 +1471,18 @@ function initJscadutils(_CSG, options = {}) {
1471
1471
  function translator(o, axis, withObj) {
1472
1472
  var objectCentroid = centroid(o);
1473
1473
  var withCentroid = centroid(withObj);
1474
- var t = axisApply(axis, (function(i) {
1474
+ var t = axisApply(axis, function(i) {
1475
1475
  return withCentroid[i] - objectCentroid[i];
1476
- }));
1476
+ });
1477
1477
  return t;
1478
1478
  }
1479
1479
  function calcCenterWith(o, axes, withObj) {
1480
1480
  var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1481
1481
  var objectCentroid = centroid(o);
1482
1482
  var withCentroid = centroid(withObj);
1483
- var t = axisApply(axes, (function(i, axis) {
1483
+ var t = axisApply(axes, function(i, axis) {
1484
1484
  return withCentroid[axis] - objectCentroid[axis];
1485
- }));
1485
+ });
1486
1486
  return delta ? add(t, delta) : t;
1487
1487
  }
1488
1488
  function centerWith(o, axis, withObj) {
@@ -1495,9 +1495,9 @@ function initJscadutils(_CSG, options = {}) {
1495
1495
  }
1496
1496
  }
1497
1497
  var dist = isNegative(offset) ? offset = size[axis] + offset : offset;
1498
- return axisApply(axis, (function(i, a) {
1498
+ return axisApply(axis, function(i, a) {
1499
1499
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1500
- }));
1500
+ });
1501
1501
  }
1502
1502
  function bisect() {
1503
1503
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -1560,14 +1560,14 @@ function initJscadutils(_CSG, options = {}) {
1560
1560
  }[[ axis, rotateaxis ].sort().join("")];
1561
1561
  var centroid = object.centroid();
1562
1562
  var rotateDelta = getDelta(objectSize, bounds, rotateOffsetAxis, rotateoffset);
1563
- var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", (function(i, a) {
1563
+ var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", function(i, a) {
1564
1564
  if (a == axis) return cutDelta[i];
1565
1565
  if (a == rotateOffsetAxis) return rotateDelta[i];
1566
1566
  return centroid[a];
1567
- })));
1567
+ }));
1568
1568
  var theRotationAxis = rotationAxes[rotateaxis];
1569
1569
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(info.orthoNormalCartesian[0], info.orthoNormalCartesian[1]).translate(cutDelta).rotate(rotationCenter, theRotationAxis, angle);
1570
- debug$1("bisect", debug$1.enabled && {
1570
+ debug$2("bisect", debug$2.enabled && {
1571
1571
  axis,
1572
1572
  offset,
1573
1573
  angle,
@@ -1648,15 +1648,18 @@ function initJscadutils(_CSG, options = {}) {
1648
1648
  return CSG.fromPolygons(polygons);
1649
1649
  }
1650
1650
  function slices2poly(slices, options, axis) {
1651
+ debug$2("slices2poly", slices, options, axis);
1652
+ options = Object.assign({
1653
+ twistangle: 0,
1654
+ twiststeps: 0
1655
+ }, options);
1651
1656
  var twistangle = options && parseFloat(options.twistangle) || 0;
1652
- var twiststeps = options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1653
- if (twistangle == 0 || twiststeps < 1) {
1654
- twiststeps = 1;
1655
- }
1657
+ options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1656
1658
  var normalVector = options.si.normalVector;
1657
1659
  var polygons = [];
1658
1660
  var first$1 = first(slices);
1659
1661
  var last$1 = last(slices);
1662
+ debug$2("slices2poly first", first$1, first$1.offset, "last", last$1);
1660
1663
  var up = first$1.offset[axis] > last$1.offset[axis];
1661
1664
  polygons = polygons.concat(first$1.poly._toPlanePolygons({
1662
1665
  translation: first$1.offset,
@@ -1675,7 +1678,7 @@ function initJscadutils(_CSG, options = {}) {
1675
1678
  return v[rotateAxis](angle * percent);
1676
1679
  };
1677
1680
  var connectorAxis = last$1.offset.minus(first$1.offset).abs();
1678
- slices.forEach((function(slice, idx) {
1681
+ slices.forEach(function(slice, idx) {
1679
1682
  if (idx < slices.length - 1) {
1680
1683
  var nextidx = idx + 1;
1681
1684
  var top = !up ? slices[nextidx] : slice;
@@ -1688,7 +1691,7 @@ function initJscadutils(_CSG, options = {}) {
1688
1691
  toConnector2: c2
1689
1692
  }));
1690
1693
  }
1691
- }));
1694
+ });
1692
1695
  return CSG.fromPolygons(polygons);
1693
1696
  }
1694
1697
  function normalVector(axis) {
@@ -1729,30 +1732,32 @@ function initJscadutils(_CSG, options = {}) {
1729
1732
  var info = dirInfo["dir" + direction];
1730
1733
  return Object.assign({
1731
1734
  axis,
1732
- cutDelta: axisApply(axis, (function(i, a) {
1735
+ cutDelta: axisApply(axis, function(i, a) {
1733
1736
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.sizeDir;
1734
- })),
1735
- moveDelta: axisApply(axis, (function(i, a) {
1737
+ }),
1738
+ moveDelta: axisApply(axis, function(i, a) {
1736
1739
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.moveDir;
1737
- }))
1740
+ })
1738
1741
  }, info, normalVector(axis));
1739
1742
  }
1740
1743
  function reShape(object, radius, orientation, options, slicer) {
1741
1744
  options = options || {};
1742
1745
  var b = object.getBounds();
1743
- var ar = Math.abs(radius);
1746
+ var absoluteRadius = Math.abs(radius);
1744
1747
  var si = sliceParams(orientation, radius, b);
1748
+ debug$2("reShape", absoluteRadius, si);
1745
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.');
1746
1750
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(si.orthoNormalCartesian[0], si.orthoNormalCartesian[1]).translate(si.cutDelta);
1747
1751
  var slice = object.sectionCut(cutplane);
1748
- var first = axisApply(si.axis, (function() {
1749
- return si.positive ? 0 : ar;
1750
- }));
1751
- var last = axisApply(si.axis, (function() {
1752
- return si.positive ? ar : 0;
1753
- }));
1752
+ var first = axisApply(si.axis, function() {
1753
+ return si.positive ? 0 : absoluteRadius;
1754
+ });
1755
+ var last = axisApply(si.axis, function() {
1756
+ return si.positive ? absoluteRadius : 0;
1757
+ });
1754
1758
  var plane = si.positive ? cutplane.plane : cutplane.plane.flipped();
1755
- var slices = slicer(first, last, slice);
1759
+ debug$2("reShape first/last", first, last);
1760
+ var slices = slicer(first, last, slice, radius);
1756
1761
  var delta = slices2poly(slices, Object.assign(options, {
1757
1762
  si
1758
1763
  }), si.axis).color(options.color);
@@ -1760,7 +1765,7 @@ function initJscadutils(_CSG, options = {}) {
1760
1765
  return union([ options.unionOriginal ? object : remainder, delta.translate(si.moveDelta) ]);
1761
1766
  }
1762
1767
  function chamfer(object, radius, orientation, options) {
1763
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1768
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1764
1769
  return [ {
1765
1770
  poly: slice,
1766
1771
  offset: new CSG.Vector3D(first)
@@ -1768,15 +1773,15 @@ function initJscadutils(_CSG, options = {}) {
1768
1773
  poly: enlarge(slice, [ -radius * 2, -radius * 2 ]),
1769
1774
  offset: new CSG.Vector3D(last)
1770
1775
  } ];
1771
- }));
1776
+ });
1772
1777
  }
1773
1778
  function fillet(object, radius, orientation, options) {
1774
1779
  options = options || {};
1775
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1780
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1776
1781
  var v1 = new CSG.Vector3D(first);
1777
1782
  var v2 = new CSG.Vector3D(last);
1778
1783
  var res = options.resolution || CSG.defaultResolution3D;
1779
- var slices = range(0, res).map((function(i) {
1784
+ var slices = range(0, res).map(function(i) {
1780
1785
  var p = i > 0 ? i / (res - 1) : 0;
1781
1786
  var v = v1.lerp(v2, p);
1782
1787
  var size = -radius * 2 - Math.cos(Math.asin(p)) * (-radius * 2);
@@ -1784,9 +1789,9 @@ function initJscadutils(_CSG, options = {}) {
1784
1789
  poly: enlarge(slice, [ size, size ]),
1785
1790
  offset: v
1786
1791
  };
1787
- }));
1792
+ });
1788
1793
  return slices;
1789
- }));
1794
+ });
1790
1795
  }
1791
1796
  function calcRotate(part, solid, axis) {
1792
1797
  var axes = {
@@ -1806,16 +1811,16 @@ function initJscadutils(_CSG, options = {}) {
1806
1811
  return part.rotate(rotationCenter, rotationAxis, angle);
1807
1812
  }
1808
1813
  function cloneProperties(from, to) {
1809
- return Object.entries(from).reduce((function(props, _ref) {
1814
+ return Object.entries(from).reduce(function(props, _ref) {
1810
1815
  var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1811
1816
  props[key] = value;
1812
1817
  return props;
1813
- }), to);
1818
+ }, to);
1814
1819
  }
1815
1820
  function clone(o) {
1816
1821
  var c = CSG.fromPolygons(o.toPolygons());
1817
1822
  cloneProperties(o, c);
1818
- debug$1("clone", o, c, CSG);
1823
+ debug$2("clone", o, c, CSG);
1819
1824
  return c;
1820
1825
  }
1821
1826
  function addConnector(object, name) {
@@ -1825,15 +1830,15 @@ function initJscadutils(_CSG, options = {}) {
1825
1830
  object.properties[name] = new CSG.Connector(point, axis, normal);
1826
1831
  return object;
1827
1832
  }
1828
- var debug$2 = Debug("jscadUtils:parts");
1833
+ var debug$1 = Debug("jscadUtils:parts");
1829
1834
  var parts = {
1830
- BBox,
1835
+ BBox: BBox$1,
1831
1836
  Cube,
1832
1837
  RoundedCube,
1833
1838
  Cylinder,
1834
1839
  Cone
1835
1840
  };
1836
- function BBox() {
1841
+ function BBox$1() {
1837
1842
  function box(object) {
1838
1843
  return CSG.cube({
1839
1844
  center: object.centroid(),
@@ -1843,13 +1848,13 @@ function initJscadutils(_CSG, options = {}) {
1843
1848
  for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1844
1849
  objects[_key] = arguments[_key];
1845
1850
  }
1846
- return objects.reduce((function(bbox, part) {
1851
+ return objects.reduce(function(bbox, part) {
1847
1852
  var object = bbox ? union([ bbox, box(part) ]) : part;
1848
1853
  return box(object);
1849
- }), undefined);
1854
+ }, undefined);
1850
1855
  }
1851
1856
  function Cube(width) {
1852
- var r = div(fromxyz(width), 2);
1857
+ var r = div$1(fromxyz(width), 2);
1853
1858
  return CSG.cube({
1854
1859
  center: r,
1855
1860
  radius: r
@@ -1864,7 +1869,7 @@ function initJscadutils(_CSG, options = {}) {
1864
1869
  } else {
1865
1870
  var r = [ x / 2, y / 2 ];
1866
1871
  }
1867
- debug$2("RoundedCube", size$1, r, thickness, corner_radius);
1872
+ debug$1("RoundedCube", size$1, r, thickness, corner_radius);
1868
1873
  var roundedcube = CAG.roundedRectangle({
1869
1874
  center: [ r[0], r[1], 0 ],
1870
1875
  radius: r,
@@ -1877,7 +1882,7 @@ function initJscadutils(_CSG, options = {}) {
1877
1882
  }
1878
1883
  function Cylinder(diameter, height) {
1879
1884
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1880
- debug$2("parts.Cylinder", diameter, height, options);
1885
+ debug$1("parts.Cylinder", diameter, height, options);
1881
1886
  options = Object.assign({
1882
1887
  start: [ 0, 0, 0 ],
1883
1888
  end: [ 0, 0, height ],
@@ -1888,7 +1893,7 @@ function initJscadutils(_CSG, options = {}) {
1888
1893
  }
1889
1894
  function Cone(diameter1, diameter2, height) {
1890
1895
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1891
- debug$2("parts.Cone", diameter1, diameter2, height, options);
1896
+ debug$1("parts.Cone", diameter1, diameter2, height, options);
1892
1897
  return CSG.cylinder(Object.assign({
1893
1898
  start: [ 0, 0, 0 ],
1894
1899
  end: [ 0, 0, height ],
@@ -1898,7 +1903,7 @@ function initJscadutils(_CSG, options = {}) {
1898
1903
  }, options));
1899
1904
  }
1900
1905
  function Hexagon(diameter, height) {
1901
- debug$2("hexagon", diameter, height);
1906
+ debug$1("hexagon", diameter, height);
1902
1907
  var radius = diameter / 2;
1903
1908
  var sqrt3 = Math.sqrt(3) / 2;
1904
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 ] ]);
@@ -1996,7 +2001,7 @@ function initJscadutils(_CSG, options = {}) {
1996
2001
  var parts$1 = Object.freeze({
1997
2002
  __proto__: null,
1998
2003
  default: parts,
1999
- BBox,
2004
+ BBox: BBox$1,
2000
2005
  Cube,
2001
2006
  RoundedCube,
2002
2007
  Cylinder,
@@ -2008,13 +2013,13 @@ function initJscadutils(_CSG, options = {}) {
2008
2013
  Board,
2009
2014
  Hardware
2010
2015
  });
2011
- var debug$3 = Debug("jscadUtils:boxes");
2016
+ var debug = Debug("jscadUtils:boxes");
2012
2017
  function RabbetJoin(box, thickness, cutHeight) {
2013
2018
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
2014
2019
  return rabbetJoin(box, thickness, cutHeight);
2015
2020
  }
2016
2021
  function topMiddleBottom(box, thickness) {
2017
- debug$3("TopMiddleBottom", box, thickness);
2022
+ debug("TopMiddleBottom", box, thickness);
2018
2023
  var bottom = box.bisect("z", thickness, {
2019
2024
  color: true
2020
2025
  });
@@ -2023,20 +2028,21 @@ function initJscadutils(_CSG, options = {}) {
2023
2028
  }
2024
2029
  function Rabett(box, thickness, gap, height, face) {
2025
2030
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2026
- debug$3("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2031
+ debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2027
2032
  gap = gap || .25;
2028
2033
  var inside = thickness - gap;
2029
2034
  var outside = -thickness + gap;
2030
- options.color = true;
2035
+ debug("inside", inside, "outside", outside);
2031
2036
  var group = Group();
2032
- debug$3("Rabbet top height:", height, "options:", options);
2033
2037
  var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
2034
- debug$3("face", face, "height", height);
2035
2038
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
2036
- debug$3("Rabbet bottom height:", lowerBisectHeight, "options:", options);
2037
2039
  var _lower2_3rd$bisect$pa = lower2_3rd.bisect("z", lowerBisectHeight, options).parts, middle = _lower2_3rd$bisect$pa.positive, bottom = _lower2_3rd$bisect$pa.negative;
2038
- group.add(top.union(middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]))), "top");
2039
- group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ]))), "bottom");
2040
+ var middleTop = middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]));
2041
+ group.add(top.union(middleTop), "top");
2042
+ var bottomOutline = middle.color("yellow").subtract(middle.color("orange").enlarge([ outside, outside, 0 ])).enlarge([ outside, outside, 0 ]);
2043
+ group.add(bottomOutline, "middle-top", true);
2044
+ group.add(middle.color("green").subtract(middle.color("pink").enlarge([ inside, inside, 0 ])), "middle-bottom", true);
2045
+ group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ])).subtract(middleTop)), "bottom");
2040
2046
  return group;
2041
2047
  }
2042
2048
  var RabettTopBottom = function rabbetTMB(box, thickness) {
@@ -2048,7 +2054,7 @@ function initJscadutils(_CSG, options = {}) {
2048
2054
  topWidth: -thickness,
2049
2055
  bottomWidth: thickness
2050
2056
  }, options);
2051
- debug$3("RabettTopBottom", box, thickness, gap, options);
2057
+ debug("RabettTopBottom", box, thickness, gap, options);
2052
2058
  var group = Group("", {
2053
2059
  box
2054
2060
  });
@@ -2094,7 +2100,7 @@ function initJscadutils(_CSG, options = {}) {
2094
2100
  };
2095
2101
  var Rectangle = function Rectangle(size, thickness, cb) {
2096
2102
  thickness = thickness || 2;
2097
- var s = div(xyz2array(size), 2);
2103
+ var s = div$1(xyz2array(size), 2);
2098
2104
  var r = add(s, thickness);
2099
2105
  var box = CSG.cube({
2100
2106
  center: r,
@@ -2114,16 +2120,16 @@ function initJscadutils(_CSG, options = {}) {
2114
2120
  if (exteriorcb) box = exteriorcb(box);
2115
2121
  return box;
2116
2122
  };
2117
- var BBox$1 = function BBox(o) {
2123
+ var BBox = function BBox(o) {
2118
2124
  depreciated("BBox", true, "Use 'parts.BBox' instead");
2119
- var s = div(xyz2array(o.size()), 2);
2125
+ var s = div$1(xyz2array(o.size()), 2);
2120
2126
  return CSG.cube({
2121
2127
  center: s,
2122
2128
  radius: s
2123
2129
  }).align(o, "xyz");
2124
2130
  };
2125
2131
  function getRadius(o) {
2126
- return div(xyz2array(o.size()), 2);
2132
+ return div$1(xyz2array(o.size()), 2);
2127
2133
  }
2128
2134
  function rabbetJoin(box, thickness) {
2129
2135
  var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
@@ -2151,7 +2157,7 @@ function initJscadutils(_CSG, options = {}) {
2151
2157
  CutOut,
2152
2158
  Rectangle,
2153
2159
  Hollow,
2154
- BBox: BBox$1
2160
+ BBox
2155
2161
  });
2156
2162
  var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
2157
2163
  group: Group,
@@ -2171,6 +2177,9 @@ function initJscadutils(_CSG, options = {}) {
2171
2177
  exports.parts = parts$1;
2172
2178
  exports.triUtils = triUtils;
2173
2179
  exports.util = util;
2180
+ Object.defineProperty(exports, "__esModule", {
2181
+ value: true
2182
+ });
2174
2183
  return exports;
2175
2184
  }({}, jsCadCSG, scadApi);
2176
2185
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
@@ -2236,15 +2245,14 @@ function initJscadRPi() {
2236
2245
  };
2237
2246
  var jscadRPi = function(exports, jscadUtils, jsCadCSG, scadApi) {
2238
2247
  "use strict";
2239
- function _interopDefaultLegacy(e) {
2240
- return e && typeof e === "object" && "default" in e ? e : {
2241
- default: e
2242
- };
2248
+ function activeCoolingFan() {
2249
+ var g = jscadUtils.Group("ActiveCoolingFan");
2250
+ var board = jscadUtils.parts.Cube([ 64, 42.5, 1 ]).subtract(jscadUtils.parts.Cube([ 64 - 58, 31.3, 1 ]).translate([ 0, 42.5 - 31.3, 0 ]).color("orange").union(jscadUtils.parts.Cube([ 28, 42.5 - 31.3, 1 ]).translate([ 64 - 28, 0, 0 ]).color("blue"))).union(jscadUtils.parts.Cube([ 19, 40, 9 ]).translate([ 64 - 58, 2.5, 0 ])).color("silver").union(jscadUtils.parts.Cube([ 30, 30, 9 ]).translate([ 64 - 58 + 19, 42.5 - 31.3, 0 ]).color("black"));
2251
+ g.add(board, "board");
2252
+ return g;
2243
2253
  }
2244
- var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
2245
- var scadApi__default = _interopDefaultLegacy(scadApi);
2246
- var CSG$1 = jsCadCSG__default["default"].CSG;
2247
- var union = scadApi__default["default"].booleanOps.union;
2254
+ jsCadCSG.CSG;
2255
+ scadApi.booleanOps.union;
2248
2256
  function RightSide(o, mb) {
2249
2257
  return o.translate(jscadUtils.array.add(o.calcSnap(mb, "z", "outside-"), o.calcSnap(mb, "x", "inside+"), o.calcSnap(mb, "y", "inside-"), [ 2, 0, 0 ]));
2250
2258
  }
@@ -2309,13 +2317,13 @@ function initJscadRPi() {
2309
2317
  function BoardLed() {
2310
2318
  return jscadUtils.parts.Cube([ 1, 2, .7 ]);
2311
2319
  }
2312
- var debug = jscadUtils.Debug("jscadRPi:BPlusMounting");
2320
+ var debug$2 = jscadUtils.Debug("jscadRPi:BPlusMounting");
2313
2321
  function holes(mb) {
2314
2322
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2315
2323
  options = Object.assign(options, {
2316
2324
  height: 8
2317
2325
  });
2318
- debug("holes", mb, options);
2326
+ debug$2("holes", mb, options);
2319
2327
  var hole = MountingHole(options.diameter || 3.25, options.height).snap(mb, "xy", "inside-").align(mb, "z");
2320
2328
  var holes = [ hole.midlineTo("x", 3.5).midlineTo("y", 3.5), hole.midlineTo("x", 61.5).midlineTo("y", 3.5), hole.midlineTo("x", 3.5).midlineTo("y", 52.5), hole.midlineTo("x", 61.5).midlineTo("y", 52.5) ];
2321
2329
  return jscadUtils.Group("hole1,hole2,hole3,hole4", holes);
@@ -2360,6 +2368,8 @@ function initJscadRPi() {
2360
2368
  group.add(BoardLed().snap(mb, "z", "outside-").midlineTo("x", 1.1).midlineTo("y", 12).color("red"), "powerled");
2361
2369
  }
2362
2370
  function pi5(group, clearance, mb) {
2371
+ group.add(jscadUtils.parts.Cube([ 12, 12, 3 ]).color("lightgray").translate([ 24, 15, 2 ]), "cpu");
2372
+ group.add(jscadUtils.parts.Cube([ 12, 12, clearance ]).color("red").translate([ 24, 15, 2 ]), "clearance-cpu", true, "clearance");
2363
2373
  group.add(RightSide(jscadUtils.parts.Cube([ 21.5, 16.5, 13.5 ]).color("lightgray"), mb).translate([ 2, 0, 0 ]).midlineTo("y", 10.2), "ethernet");
2364
2374
  group.add(jscadUtils.parts.Cube([ clearance, 16.5, 13.5 ]).align(group.parts.ethernet, "yz").snap(group.parts.ethernet, "x", "outside-").color("red"), "clearance-ethernet", true, "clearance");
2365
2375
  var usb = jscadUtils.Group();
@@ -2425,9 +2435,15 @@ function initJscadRPi() {
2425
2435
  group.add(group.holes[1], "hole2", true);
2426
2436
  group.add(group.holes[2], "hole3", true);
2427
2437
  group.add(group.holes[3], "hole4", true);
2438
+ if (model >= 5) {
2439
+ group.holes.push(MountingHole(3.25, 8).snap(mb, "xy", "inside-").align(mb, "z").midlineTo("x", 3.5).midlineTo("y", 6 + 3.5));
2440
+ group.add(group.holes[4], "fan1hole", true);
2441
+ group.holes.push(MountingHole(3.25, 8).snap(mb, "xy", "inside-").align(mb, "z").midlineTo("x", 3.5 + 58).midlineTo("y", 52.5 - 6));
2442
+ group.add(group.holes[5], "fan2hole", true);
2443
+ }
2428
2444
  return group;
2429
2445
  }
2430
- function CameraModuleV1() {
2446
+ function CameraModuleV1$1() {
2431
2447
  var t = 1.1;
2432
2448
  var height = {
2433
2449
  sensor: 5.9 - t,
@@ -2440,27 +2456,27 @@ function initJscadRPi() {
2440
2456
  }
2441
2457
  g.holes = [ Hole(2, 2).color("yellow"), Hole(2, 23), Hole(12.5 + 2, 2), Hole(12.5 + 2, 23) ];
2442
2458
  g.add(jscadUtils.Group("hole0,hole1,hole2,hole3", g.holes), "hole", false, "holes");
2443
- var mounts = g.holes.reduce((function(m, h, i) {
2459
+ var mounts = g.holes.reduce(function(m, h, i) {
2444
2460
  m["mount".concat(i)] = jscadUtils.parts.Cylinder(4, 2).align(h, "xy").snap(g.parts.board, "z", "outside-");
2445
2461
  return m;
2446
- }), {});
2462
+ }, {});
2447
2463
  g.add(jscadUtils.Group(mounts), "mounts", true, "mounts");
2448
- var pins = g.holes.reduce((function(m, h, i) {
2464
+ var pins = g.holes.reduce(function(m, h, i) {
2449
2465
  m["pin".concat(i)] = jscadUtils.parts.Cylinder(jscadUtils.util.nearest.under(1.5), height.board).align(h, "xy").align(g.parts.board, "z");
2450
2466
  return m;
2451
- }), {});
2467
+ }, {});
2452
2468
  g.add(jscadUtils.Group(pins), "pins", true, "pins");
2453
2469
  g.add(jscadUtils.parts.Cube([ 8.5, 8.5, 2 ]).snap(g.parts.board, "xy", "inside-").snap(g.parts.board, "z", "outside-").midlineTo("x", 12.5 + 2).midlineTo("y", 8.5 + 4).color("black"), "sensor");
2454
2470
  g.add(jscadUtils.parts.Cube([ 8.5, 8.5, height.sensor - 2 ]).align(g.parts.sensor, "xy").snap(g.parts.sensor, "z", "outside-").color("gray"), "lense");
2455
2471
  g.add(jscadUtils.parts.Cube([ 7.56, 10, 2.65 - t ]).snap(g.parts.board, "z", "outside-").align(g.parts.lense, "y", "inside-").snap(g.parts.lense, "x", "outside+", -1).color("gray"), "lenseribbon");
2456
2472
  g.add(jscadUtils.parts.Cube([ 5.5, 17, 3 ]).snap(g.parts.board, "x", "inside+").snap(g.parts.board, "y", "inside-").snap(g.parts.board, "z", "outside+").midlineTo("y", 12.5), "ribbon");
2457
- g.add(jscadUtils.parts.RoundedCube(24 - 5.5, 25, 2.5 - t, 2).snap(g.parts.board, "xy", "inside-").snap(g.parts.board, "z", "outside+").subtract(g.holes.map((function(hole) {
2473
+ g.add(jscadUtils.parts.RoundedCube(24 - 5.5, 25, 2.5 - t, 2).snap(g.parts.board, "xy", "inside-").snap(g.parts.board, "z", "outside+").subtract(g.holes.map(function(hole) {
2458
2474
  return hole.enlarge(3, 3, 5);
2459
- }))).color("red"), "bottom-nogo");
2475
+ })).color("red"), "bottom-nogo");
2460
2476
  g.add(g.parts.ribbon.enlarge(2, -1, -1).snap(g.parts.ribbon, "x", "outside-").color("red"), "ribbon-nogo");
2461
2477
  return g;
2462
2478
  }
2463
- function CameraModuleV1$1() {
2479
+ function CameraModuleV1() {
2464
2480
  var t = 1.1;
2465
2481
  var height = {
2466
2482
  sensor: 4 - t,
@@ -2473,23 +2489,23 @@ function initJscadRPi() {
2473
2489
  }
2474
2490
  g.holes = [ Hole(2, 2).color("yellow"), Hole(2, 23), Hole(14.5, 2), Hole(14.5, 23) ];
2475
2491
  g.add(jscadUtils.Group("hole0,hole1,hole2,hole3", g.holes), "hole", false, "holes");
2476
- var mounts = g.holes.reduce((function(m, h, i) {
2492
+ var mounts = g.holes.reduce(function(m, h, i) {
2477
2493
  m["mount".concat(i)] = jscadUtils.parts.Cylinder(4, height.sensor).align(h, "xy").snap(g.parts.board, "z", "outside-");
2478
2494
  return m;
2479
- }), {});
2495
+ }, {});
2480
2496
  g.add(jscadUtils.Group(mounts), "mounts", true, "mounts");
2481
- var pins = g.holes.reduce((function(m, h, i) {
2497
+ var pins = g.holes.reduce(function(m, h, i) {
2482
2498
  m["pin".concat(i)] = jscadUtils.parts.Cylinder(jscadUtils.util.nearest.under(1.5), height.board).align(h, "xy").align(g.parts.board, "z");
2483
2499
  return m;
2484
- }), {});
2500
+ }, {});
2485
2501
  g.add(jscadUtils.Group(pins), "pins", true, "pins");
2486
2502
  g.add(jscadUtils.parts.Cube([ 8.5, 8.5, height.sensor ]).snap(g.parts.board, "xy", "inside-").snap(g.parts.board, "z", "outside-").midlineTo("x", 14.5).midlineTo("y", 12.5).color("black"), "sensor");
2487
2503
  g.add(jscadUtils.parts.Cylinder(7.3, 1.6).align(g.parts.sensor, "xy").snap(g.parts.sensor, "z", "outside-").color("gray"), "lense");
2488
2504
  g.add(jscadUtils.parts.Cube([ 4, 9, 2.65 - t ]).snap(g.parts.board, "xy", "inside-").snap(g.parts.board, "z", "outside-").midlineTo("x", 4.7).midlineTo("y", 13.8).stretch("x", 4).color("gray"), "lenseribbon");
2489
2505
  g.add(jscadUtils.parts.Cube([ 5.5, 20.8, 3.55 - t ]).snap(g.parts.board, "x", "inside+").snap(g.parts.board, "y", "inside-").snap(g.parts.board, "z", "outside+").midlineTo("y", 12.5), "ribbon");
2490
- g.add(jscadUtils.parts.RoundedCube(23.862 - 5.5, 25, 2.5 - t, 2).snap(g.parts.board, "xy", "inside-").snap(g.parts.board, "z", "outside+").subtract(g.holes.map((function(hole) {
2506
+ g.add(jscadUtils.parts.RoundedCube(23.862 - 5.5, 25, 2.5 - t, 2).snap(g.parts.board, "xy", "inside-").snap(g.parts.board, "z", "outside+").subtract(g.holes.map(function(hole) {
2491
2507
  return hole.enlarge(3, 3, 5);
2492
- }))).color("red"), "bottom-nogo");
2508
+ })).color("red"), "bottom-nogo");
2493
2509
  g.add(g.parts.ribbon.enlarge(2, -1, -1).snap(g.parts.ribbon, "x", "outside-").color("red"), "ribbon-nogo");
2494
2510
  return g;
2495
2511
  }
@@ -2515,31 +2531,30 @@ function initJscadRPi() {
2515
2531
  var peg = MountingHole(null, options.height + 3);
2516
2532
  return standoff.union(peg);
2517
2533
  }
2518
- function _toConsumableArray(arr) {
2519
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
2520
- }
2521
- function _arrayWithoutHoles(arr) {
2522
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
2534
+ function _arrayLikeToArray(r, a) {
2535
+ (null == a || a > r.length) && (a = r.length);
2536
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2537
+ return n;
2523
2538
  }
2524
- function _iterableToArray(iter) {
2525
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
2539
+ function _arrayWithoutHoles(r) {
2540
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
2526
2541
  }
2527
- function _unsupportedIterableToArray(o, minLen) {
2528
- if (!o) return;
2529
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2530
- var n = Object.prototype.toString.call(o).slice(8, -1);
2531
- if (n === "Object" && o.constructor) n = o.constructor.name;
2532
- if (n === "Map" || n === "Set") return Array.from(o);
2533
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2534
- }
2535
- function _arrayLikeToArray(arr, len) {
2536
- if (len == null || len > arr.length) len = arr.length;
2537
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
2538
- return arr2;
2542
+ function _iterableToArray(r) {
2543
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2539
2544
  }
2540
2545
  function _nonIterableSpread() {
2541
2546
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2542
2547
  }
2548
+ function _toConsumableArray(r) {
2549
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
2550
+ }
2551
+ function _unsupportedIterableToArray(r, a) {
2552
+ if (r) {
2553
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
2554
+ var t = {}.toString.call(r).slice(8, -1);
2555
+ 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;
2556
+ }
2557
+ }
2543
2558
  function HQCameraModule() {
2544
2559
  var _camera$holes;
2545
2560
  var t = 1.1;
@@ -2610,8 +2625,8 @@ function initJscadRPi() {
2610
2625
  group.add(buttons[3], "button4");
2611
2626
  return group;
2612
2627
  }
2613
- var union$2 = scadApi.booleanOps.union;
2614
- var debug$2 = jscadUtils.Debug("jscadRPi:PiTFT24");
2628
+ var union = scadApi.booleanOps.union;
2629
+ var debug = jscadUtils.Debug("jscadRPi:PiTFT24");
2615
2630
  function PiTFT24() {
2616
2631
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2617
2632
  var pi = arguments.length > 1 ? arguments[1] : undefined;
@@ -2622,7 +2637,7 @@ function initJscadRPi() {
2622
2637
  buttonWireYOffset: 5,
2623
2638
  clearance: .9
2624
2639
  });
2625
- debug$2("PiTFT24", options);
2640
+ debug("PiTFT24", options);
2626
2641
  var hat = Hat(pi);
2627
2642
  var mb = hat.parts.mb;
2628
2643
  var group = jscadUtils.Group();
@@ -2636,36 +2651,36 @@ function initJscadRPi() {
2636
2651
  group.add(lcdbevel.translate(lcdbevel.calcSnap(mb, "xy", "inside-")).translate(lcdbevel.calcSnap(mb, "z", "outside-")).translate([ 4.5, 7, 0 ]), "lcdbevel");
2637
2652
  var buttonBase = jscadUtils.parts.Cube([ 6.1, 3.5, 3.55 ]).color("beige").snap(mb, "z", "outside-").snap(mb, "xy", "inside-").midlineTo("y", 2.5);
2638
2653
  var button = buttonBase.union(jscadUtils.parts.Cube([ 3, 1.5, .5 ]).color("white").snap(buttonBase, "z", "outside-").align(buttonBase, "xy"));
2639
- var buttons = [ 12.39, 12.39 + 10, 12.39 + 20, 12.39 + 30, 12.39 + 40 ].map((function(midpoint) {
2654
+ var buttons = [ 12.39, 12.39 + 10, 12.39 + 20, 12.39 + 30, 12.39 + 40 ].map(function(midpoint) {
2640
2655
  return button.midlineTo("x", midpoint);
2641
- }));
2656
+ });
2642
2657
  group.add(jscadUtils.Group("1,2,3,4,5", buttons), "buttons", false, "button");
2643
2658
  var capBaseHeight = options.capBaseHeight;
2644
2659
  var buttonCapBase = jscadUtils.parts.Cube([ 6.6, 4, capBaseHeight ]).color("blue");
2645
2660
  var buttonCapTop = jscadUtils.parts.Cube([ 6.1, 3.5, options.buttonCapHeight - capBaseHeight ]).snap(buttonCapBase, "z", "outside-").align(buttonCapBase, "xy").fillet(1, "z+").color("deepskyblue");
2646
- var buttonCaps = buttons.map((function(button) {
2647
- return union$2([ buttonCapBase, buttonCapTop ]).snap(button, "z", "outside-").align(button, "xy");
2648
- }));
2649
- group.add(union$2(buttonCaps), "buttonCaps", hiddenPart);
2650
- group.add(union$2(buttonCaps.map((function(button) {
2651
- return union$2([ buttonCapBase.align(button, "xy").snap(button, "z", "inside-").enlarge([ options.clearance, options.clearance, 1 ]), jscadUtils.parts.Cube([ 6.1, 3.5, options.buttonCapHeight - capBaseHeight ]).align(button, "xy").snap(button, "z", "inside-").enlarge([ options.clearance, options.clearance, 1 ]) ]);
2652
- }))), "buttonCapClearance", hiddenPart);
2661
+ var buttonCaps = buttons.map(function(button) {
2662
+ return union([ buttonCapBase, buttonCapTop ]).snap(button, "z", "outside-").align(button, "xy");
2663
+ });
2664
+ group.add(union(buttonCaps), "buttonCaps", hiddenPart);
2665
+ group.add(union(buttonCaps.map(function(button) {
2666
+ return union([ buttonCapBase.align(button, "xy").snap(button, "z", "inside-").enlarge([ options.clearance, options.clearance, 1 ]), jscadUtils.parts.Cube([ 6.1, 3.5, options.buttonCapHeight - capBaseHeight ]).align(button, "xy").snap(button, "z", "inside-").enlarge([ options.clearance, options.clearance, 1 ]) ]);
2667
+ })), "buttonCapClearance", hiddenPart);
2653
2668
  var bwthickness = options.capBaseHeight;
2654
2669
  var connector = LeftSide(jscadUtils.parts.Cube([ bwthickness, options.buttonWireYOffset, bwthickness ]), mb).snap(buttonCaps[0], "z", "inside-").snap(buttonCaps[0], "y", "outside+").color("blue");
2655
2670
  var buttonWire = jscadUtils.parts.Cube([ 40, bwthickness, bwthickness ]).snap(buttonCaps[0], "x", "center-").snap(buttonCaps[0], "z", "inside-").snap(connector, "y", "inside-").color("blue");
2656
- group.add(union$2(buttonWire), "buttonWire", hiddenPart);
2657
- var buttonWireConnector = buttonCaps.map((function(buttonCap) {
2671
+ group.add(union(buttonWire), "buttonWire", hiddenPart);
2672
+ var buttonWireConnector = buttonCaps.map(function(buttonCap) {
2658
2673
  return connector.align(buttonCap, "x");
2659
- }));
2660
- group.add(union$2(buttonWireConnector), "buttonWireConnector", hiddenPart);
2661
- var buttonWireClearance = union$2(buttonWireConnector.map((function(connector) {
2674
+ });
2675
+ group.add(union(buttonWireConnector), "buttonWireConnector", hiddenPart);
2676
+ var buttonWireClearance = union(buttonWireConnector.map(function(connector) {
2662
2677
  return connector.enlarge([ options.clearance, options.clearance, options.buttonCapHeight ]);
2663
- }))).union(buttonWire.enlarge([ options.clearance, options.clearance, options.buttonCapHeight ])).snap(buttonWire, "z", "inside+").color("red");
2678
+ })).union(buttonWire.enlarge([ options.clearance, options.clearance, options.buttonCapHeight ])).snap(buttonWire, "z", "inside+").color("red");
2664
2679
  group.add(buttonWireClearance, "buttonWireClearance", hiddenPart);
2665
2680
  group.add(jscadUtils.parts.Cube([ 15, 33, 7 ]).snap(mb, "x", "inside-").snap(mb, "z", "outside+").align(mb, "y").color("red"), "gpio2", hiddenPart);
2666
2681
  return group;
2667
2682
  }
2668
- var debug$3 = jscadUtils.Debug("jscadRPi:Spacer");
2683
+ jscadUtils.Debug("jscadRPi:Spacer");
2669
2684
  function Spacer() {
2670
2685
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2671
2686
  var mb = arguments.length > 1 ? arguments[1] : undefined;
@@ -2701,9 +2716,10 @@ function initJscadRPi() {
2701
2716
  var assembly = spacers.union(gusset.unionIf(cross, !options.hollow).translate([ 0, 0, -options.offset ])).subtractIf(gpio.enlarge([ 1, 1, 0 ]), options.gpio);
2702
2717
  return assembly.color("yellow");
2703
2718
  }
2719
+ exports.ActiveCoolingFan = activeCoolingFan;
2704
2720
  exports.BPlus = BPlus;
2705
- exports.CameraModuleV1 = CameraModuleV1;
2706
- exports.CameraModuleV2 = CameraModuleV1$1;
2721
+ exports.CameraModuleV1 = CameraModuleV1$1;
2722
+ exports.CameraModuleV2 = CameraModuleV1;
2707
2723
  exports.HQCameraModule = HQCameraModule;
2708
2724
  exports.Hat = Hat;
2709
2725
  exports.HatStandoff = HatStandoff;