@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.
@@ -1,25 +1,32 @@
1
1
  function main() {
2
2
  util.init(CSG);
3
3
 
4
- var pi = RaspberryPi.BPlus().align('mb', util.unitCube(), 'xy');
4
+ var pi = RaspberryPi.BPlus(5, 25).align('mb', util.unitCube(), 'xy');
5
5
 
6
6
  /**
7
7
  * Add a spacer to support the screen.
8
8
  */
9
- pi.add(RaspberryPi.Spacer({}, pi.parts.mb), 'spacer');
9
+ // pi.add(RaspberryPi.Spacer({}, pi.parts.mb), 'spacer');
10
10
 
11
11
  /**
12
12
  * Add the screen and align it with the pi and the top of the spacer.
13
13
  */
14
14
  pi.add(
15
- RaspberryPi.PiTFT24({}, pi.parts.mb).snap(
16
- 'mb',
17
- pi.parts.spacer,
18
- 'z',
19
- 'outside-'
20
- ),
21
- 'screen'
15
+ RaspberryPi.MiniPiTFT()
16
+ .snap('board', pi.parts.mb, 'x', 'inside-')
17
+ .snap('board', pi.parts.mb, 'y', 'inside+')
18
+ .snap('board', pi.parts.mb, 'z', 'outside-', 15),
19
+ 'miniPiTFT',
20
+ true,
21
+ 'miniPiTFT'
22
22
  );
23
+
24
+ pi.add(RaspberryPi.ActiveCoolingFan()
25
+ .snap('board', pi.parts.mb, 'x', 'inside-')
26
+ .snap('board', pi.parts.mb, 'y', 'inside+')
27
+ .snap('board', pi.parts.cpu, 'z', 'outside-', 1)
28
+ .translate([0, -6, 0]), "activeCoolingFan", true, 'activeCoolingFan');
29
+
23
30
  return pi.combineAll();
24
31
  }
25
32
 
@@ -68,8 +75,13 @@ function initJscadutils(_CSG, options = {}) {
68
75
  });
69
76
  var jscadUtils = function(exports, jsCadCSG, scadApi) {
70
77
  "use strict";
71
- jsCadCSG = jsCadCSG && Object.prototype.hasOwnProperty.call(jsCadCSG, "default") ? jsCadCSG["default"] : jsCadCSG;
72
- scadApi = scadApi && Object.prototype.hasOwnProperty.call(scadApi, "default") ? scadApi["default"] : scadApi;
78
+ function _interopDefaultLegacy(e) {
79
+ return e && typeof e === "object" && "default" in e ? e : {
80
+ default: e
81
+ };
82
+ }
83
+ var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
84
+ var scadApi__default = _interopDefaultLegacy(scadApi);
73
85
  var util = Object.freeze({
74
86
  __proto__: null,
75
87
  get NOZZEL_SIZE() {
@@ -154,7 +166,7 @@ function initJscadutils(_CSG, options = {}) {
154
166
  return divxyz;
155
167
  },
156
168
  get div() {
157
- return div$1;
169
+ return div;
158
170
  },
159
171
  get mulxyz() {
160
172
  return mulxyz;
@@ -286,104 +298,98 @@ function initJscadutils(_CSG, options = {}) {
286
298
  return addConnector;
287
299
  }
288
300
  });
289
- function _typeof(obj) {
290
- "@babel/helpers - typeof";
291
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
292
- _typeof = function(obj) {
293
- return typeof obj;
294
- };
295
- } else {
296
- _typeof = function(obj) {
297
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
298
- };
299
- }
300
- return _typeof(obj);
301
- }
302
- function _defineProperty(obj, key, value) {
303
- if (key in obj) {
304
- Object.defineProperty(obj, key, {
305
- value,
306
- enumerable: true,
307
- configurable: true,
308
- writable: true
309
- });
310
- } else {
311
- obj[key] = value;
312
- }
313
- return obj;
314
- }
315
- function ownKeys(object, enumerableOnly) {
316
- var keys = Object.keys(object);
317
- if (Object.getOwnPropertySymbols) {
318
- var symbols = Object.getOwnPropertySymbols(object);
319
- if (enumerableOnly) symbols = symbols.filter((function(sym) {
320
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
321
- }));
322
- keys.push.apply(keys, symbols);
323
- }
324
- return keys;
325
- }
326
- function _objectSpread2(target) {
327
- for (var i = 1; i < arguments.length; i++) {
328
- var source = arguments[i] != null ? arguments[i] : {};
329
- if (i % 2) {
330
- ownKeys(Object(source), true).forEach((function(key) {
331
- _defineProperty(target, key, source[key]);
332
- }));
333
- } else if (Object.getOwnPropertyDescriptors) {
334
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
335
- } else {
336
- ownKeys(Object(source)).forEach((function(key) {
337
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
338
- }));
301
+ function _arrayLikeToArray(r, a) {
302
+ (null == a || a > r.length) && (a = r.length);
303
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
304
+ return n;
305
+ }
306
+ function _arrayWithHoles(r) {
307
+ if (Array.isArray(r)) return r;
308
+ }
309
+ function _defineProperty(e, r, t) {
310
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
311
+ value: t,
312
+ enumerable: !0,
313
+ configurable: !0,
314
+ writable: !0
315
+ }) : e[r] = t, e;
316
+ }
317
+ function _iterableToArrayLimit(r, l) {
318
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
319
+ if (null != t) {
320
+ var e, n, i, u, a = [], f = !0, o = !1;
321
+ try {
322
+ if (i = (t = t.call(r)).next, 0 === l) {
323
+ if (Object(t) !== t) return;
324
+ f = !1;
325
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
326
+ } catch (r) {
327
+ o = !0, n = r;
328
+ } finally {
329
+ try {
330
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
331
+ } finally {
332
+ if (o) throw n;
333
+ }
339
334
  }
335
+ return a;
340
336
  }
341
- return target;
342
337
  }
343
- function _slicedToArray(arr, i) {
344
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
345
- }
346
- function _arrayWithHoles(arr) {
347
- if (Array.isArray(arr)) return arr;
338
+ function _nonIterableRest() {
339
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
348
340
  }
349
- function _iterableToArrayLimit(arr, i) {
350
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
351
- var _arr = [];
352
- var _n = true;
353
- var _d = false;
354
- var _e = undefined;
355
- try {
356
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
357
- _arr.push(_s.value);
358
- if (i && _arr.length === i) break;
359
- }
360
- } catch (err) {
361
- _d = true;
362
- _e = err;
363
- } finally {
364
- try {
365
- if (!_n && _i["return"] != null) _i["return"]();
366
- } finally {
367
- if (_d) throw _e;
368
- }
341
+ function ownKeys(e, r) {
342
+ var t = Object.keys(e);
343
+ if (Object.getOwnPropertySymbols) {
344
+ var o = Object.getOwnPropertySymbols(e);
345
+ r && (o = o.filter(function(r) {
346
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
347
+ })), t.push.apply(t, o);
369
348
  }
370
- return _arr;
349
+ return t;
371
350
  }
372
- function _unsupportedIterableToArray(o, minLen) {
373
- if (!o) return;
374
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
375
- var n = Object.prototype.toString.call(o).slice(8, -1);
376
- if (n === "Object" && o.constructor) n = o.constructor.name;
377
- if (n === "Map" || n === "Set") return Array.from(o);
378
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
351
+ function _objectSpread2(e) {
352
+ for (var r = 1; r < arguments.length; r++) {
353
+ var t = null != arguments[r] ? arguments[r] : {};
354
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
355
+ _defineProperty(e, r, t[r]);
356
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
357
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
358
+ });
359
+ }
360
+ return e;
361
+ }
362
+ function _slicedToArray(r, e) {
363
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
364
+ }
365
+ function _toPrimitive(t, r) {
366
+ if ("object" != typeof t || !t) return t;
367
+ var e = t[Symbol.toPrimitive];
368
+ if (void 0 !== e) {
369
+ var i = e.call(t, r || "default");
370
+ if ("object" != typeof i) return i;
371
+ throw new TypeError("@@toPrimitive must return a primitive value.");
372
+ }
373
+ return ("string" === r ? String : Number)(t);
379
374
  }
380
- function _arrayLikeToArray(arr, len) {
381
- if (len == null || len > arr.length) len = arr.length;
382
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
383
- return arr2;
375
+ function _toPropertyKey(t) {
376
+ var i = _toPrimitive(t, "string");
377
+ return "symbol" == typeof i ? i : i + "";
384
378
  }
385
- function _nonIterableRest() {
386
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
379
+ function _typeof(o) {
380
+ "@babel/helpers - typeof";
381
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
382
+ return typeof o;
383
+ } : function(o) {
384
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
385
+ }, _typeof(o);
386
+ }
387
+ function _unsupportedIterableToArray(r, a) {
388
+ if (r) {
389
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
390
+ var t = {}.toString.call(r).slice(8, -1);
391
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
392
+ }
387
393
  }
388
394
  var toRadians = function toRadians(deg) {
389
395
  return deg / 180 * Math.PI;
@@ -443,30 +449,30 @@ function initJscadutils(_CSG, options = {}) {
443
449
  solve90ac,
444
450
  solveab
445
451
  });
446
- var div = function div(a, f) {
447
- return a.map((function(e) {
452
+ var div$1 = function div(a, f) {
453
+ return a.map(function(e) {
448
454
  return e / f;
449
- }));
455
+ });
450
456
  };
451
457
  var addValue = function addValue(a, f) {
452
- return a.map((function(e) {
458
+ return a.map(function(e) {
453
459
  return e + f;
454
- }));
460
+ });
455
461
  };
456
462
  var addArray = function addArray(a, f) {
457
- return a.map((function(e, i) {
463
+ return a.map(function(e, i) {
458
464
  return e + f[i];
459
- }));
465
+ });
460
466
  };
461
467
  var add = function add(a) {
462
- return Array.prototype.slice.call(arguments, 1).reduce((function(result, arg) {
468
+ return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
463
469
  if (Array.isArray(arg)) {
464
470
  result = addArray(result, arg);
465
471
  } else {
466
472
  result = addValue(result, arg);
467
473
  }
468
474
  return result;
469
- }), a);
475
+ }, a);
470
476
  };
471
477
  var fromxyz = function fromxyz(object) {
472
478
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
@@ -485,9 +491,9 @@ function initJscadutils(_CSG, options = {}) {
485
491
  return a && a.length > 0 ? a[a.length - 1] : undefined;
486
492
  };
487
493
  var min = function min(a) {
488
- return a.reduce((function(result, value) {
494
+ return a.reduce(function(result, value) {
489
495
  return value < result ? value : result;
490
- }), Number.MAX_VALUE);
496
+ }, Number.MAX_VALUE);
491
497
  };
492
498
  var range = function range(a, b) {
493
499
  var result = [];
@@ -498,7 +504,7 @@ function initJscadutils(_CSG, options = {}) {
498
504
  };
499
505
  var array = Object.freeze({
500
506
  __proto__: null,
501
- div,
507
+ div: div$1,
502
508
  addValue,
503
509
  addArray,
504
510
  add,
@@ -521,11 +527,11 @@ function initJscadutils(_CSG, options = {}) {
521
527
  }
522
528
  }, jscadUtilsDebug || {});
523
529
  var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
524
- var enabled = checks.enabled.some((function checkEnabled(check) {
530
+ var enabled = checks.enabled.some(function checkEnabled(check) {
525
531
  return check.test(name);
526
- })) && !checks.disabled.some((function checkEnabled(check) {
532
+ }) && !checks.disabled.some(function checkEnabled(check) {
527
533
  return check.test(name);
528
- }));
534
+ });
529
535
  var logger = enabled ? checks.options.browser ? function() {
530
536
  var _console;
531
537
  for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -712,9 +718,9 @@ function initJscadutils(_CSG, options = {}) {
712
718
  function color(o, r, g, b, a) {
713
719
  if (typeof r !== "string") return o.setColor(r, g, b, a);
714
720
  if (r === "") return o;
715
- var c = name2rgb(r).map((function(x) {
721
+ var c = name2rgb(r).map(function(x) {
716
722
  return x / 255;
717
- }));
723
+ });
718
724
  c[3] = g || 1;
719
725
  return o.setColor(c);
720
726
  }
@@ -816,10 +822,10 @@ function initJscadutils(_CSG, options = {}) {
816
822
  if (arguments.length === 1) {
817
823
  return this._translate(arguments[0]);
818
824
  } else {
819
- var t = Array.prototype.slice.call(arguments, 0).reduce((function(result, arg) {
825
+ var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
820
826
  result = undefined(result, arg);
821
827
  return result;
822
- }), [ 0, 0, 0 ]);
828
+ }, [ 0, 0, 0 ]);
823
829
  return this._translate(t);
824
830
  }
825
831
  };
@@ -829,9 +835,9 @@ function initJscadutils(_CSG, options = {}) {
829
835
  proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
830
836
  var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
831
837
  var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
832
- var myConnector = myConnectorName.split(".").reduce((function(a, v) {
838
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
833
839
  return a[v];
834
- }), this.properties);
840
+ }, this.properties);
835
841
  if (!myConnector) {
836
842
  error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
837
843
  }
@@ -843,12 +849,12 @@ function initJscadutils(_CSG, options = {}) {
843
849
  __proto__: null,
844
850
  default: init
845
851
  });
846
- var CSG = jsCadCSG.CSG, CAG = jsCadCSG.CAG;
847
- var rectangular_extrude = scadApi.extrusions.rectangular_extrude;
848
- var _scadApi$text = scadApi.text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
849
- var union = scadApi.booleanOps.union;
852
+ var CSG = jsCadCSG__default["default"].CSG, CAG = jsCadCSG__default["default"].CAG;
853
+ var rectangular_extrude = scadApi__default["default"].extrusions.rectangular_extrude;
854
+ var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
855
+ var union = scadApi__default["default"].booleanOps.union;
850
856
  init(CSG);
851
- var debug = Debug("jscadUtils:group");
857
+ var debug$3 = Debug("jscadUtils:group");
852
858
  function JsCadUtilsGroup() {
853
859
  var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
854
860
  var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -859,16 +865,16 @@ function initJscadutils(_CSG, options = {}) {
859
865
  this.holes = holes;
860
866
  }
861
867
  JsCadUtilsGroup.prototype.add = function(object, name, hidden, subparts, parts) {
862
- debug("add", object, name, hidden, subparts, parts);
868
+ debug$3("add", object, name, hidden, subparts, parts);
863
869
  var self = this;
864
870
  if (object.parts) {
865
871
  if (name) {
866
872
  if (!hidden) self.names.push(name);
867
873
  self.parts[name] = object.combine(parts);
868
874
  if (subparts) {
869
- Object.keys(object.parts).forEach((function(key) {
875
+ Object.keys(object.parts).forEach(function(key) {
870
876
  self.parts[subparts + key] = object.parts[key];
871
- }));
877
+ });
872
878
  }
873
879
  } else {
874
880
  Object.assign(self.parts, object.parts);
@@ -894,29 +900,30 @@ function initJscadutils(_CSG, options = {}) {
894
900
  if (pieces.length === 0) {
895
901
  throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
896
902
  }
897
- debug("combine", self.names, self.parts);
898
- var g = union(mapPick(self.parts, pieces, (function(value, key, index, object) {
903
+ debug$3("combine", self.names, self.parts);
904
+ var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
905
+ debug$3("combine mapPick", value, key, object);
899
906
  return map ? map(value, key, index, object) : identity(value);
900
- }), self.name));
907
+ }, self.name));
901
908
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
902
909
  } catch (err) {
903
- debug("combine error", this, pieces, options, err);
910
+ debug$3("combine error", this, pieces, options, err);
904
911
  throw error('group::combine error "'.concat(err.message || err.toString(), '"\nthis: ').concat(this, '\npieces: "').concat(pieces, '"\noptions: ').concat(JSON.stringify(options, null, 2), "\nstack: ").concat(err.stack, "\n"), "JSCAD_UTILS_GROUP_ERROR");
905
912
  }
906
913
  };
907
914
  JsCadUtilsGroup.prototype.map = function(cb) {
908
915
  var self = this;
909
- self.parts = Object.keys(self.parts).filter((function(k) {
916
+ self.parts = Object.keys(self.parts).filter(function(k) {
910
917
  return k !== "holes";
911
- })).reduce((function(result, key) {
918
+ }).reduce(function(result, key) {
912
919
  result[key] = cb(self.parts[key], key);
913
920
  return result;
914
- }), {});
921
+ }, {});
915
922
  if (self.holes) {
916
923
  if (Array.isArray(self.holes)) {
917
- self.holes = self.holes.map((function(hole, idx) {
924
+ self.holes = self.holes.map(function(hole, idx) {
918
925
  return cb(hole, idx);
919
- }));
926
+ });
920
927
  } else {
921
928
  self.holes = cb(self.holes, "holes");
922
929
  }
@@ -924,7 +931,7 @@ function initJscadutils(_CSG, options = {}) {
924
931
  return self;
925
932
  };
926
933
  JsCadUtilsGroup.prototype.clone = function(name, map) {
927
- debug("clone", name, _typeof(name), map);
934
+ debug$3("clone", name, _typeof(name), map);
928
935
  var self = this;
929
936
  if (typeof name == "function") {
930
937
  map = name;
@@ -932,15 +939,15 @@ function initJscadutils(_CSG, options = {}) {
932
939
  }
933
940
  if (!map) map = identity;
934
941
  var group = Group(name);
935
- Object.keys(self.parts).forEach((function(key) {
942
+ Object.keys(self.parts).forEach(function(key) {
936
943
  var part = self.parts[key];
937
944
  var hidden = self.names.indexOf(key) == -1;
938
945
  group.add(map(clone(part)), key, hidden);
939
- }));
946
+ });
940
947
  if (self.holes) {
941
- group.holes = toArray(self.holes).map((function(part) {
948
+ group.holes = toArray(self.holes).map(function(part) {
942
949
  return map(CSG.fromPolygons(part.toPolygons()), "holes");
943
- }));
950
+ });
944
951
  }
945
952
  return group;
946
953
  };
@@ -957,9 +964,9 @@ function initJscadutils(_CSG, options = {}) {
957
964
  }
958
965
  var rotationCenter = solid.centroid();
959
966
  var rotationAxis = axes[axis];
960
- self.map((function(part) {
967
+ self.map(function(part) {
961
968
  return part.rotate(rotationCenter, rotationAxis, angle);
962
- }));
969
+ });
963
970
  return self;
964
971
  };
965
972
  JsCadUtilsGroup.prototype.combineAll = function(options, map) {
@@ -970,12 +977,12 @@ function initJscadutils(_CSG, options = {}) {
970
977
  try {
971
978
  var self = this;
972
979
  var t = calcSnap(self.combine(part), to, axis, orientation, delta);
973
- self.map((function(part) {
980
+ self.map(function(part) {
974
981
  return part.translate(t);
975
- }));
982
+ });
976
983
  return self;
977
984
  } catch (err) {
978
- debug("snap error", this, part, to, axis, delta, err);
985
+ debug$3("snap error", this, part, to, axis, delta, err);
979
986
  throw error('group::snap error "'.concat(err.message || err.toString(), '"\nthis: ').concat(this, '\npart: "').concat(part, '"\nto: ').concat(to, '\naxis: "').concat(axis, '"\norientation: "').concat(orientation, '"\ndelta: "').concat(delta, '"\nstack: ').concat(err.stack, "\n"), "JSCAD_UTILS_GROUP_ERROR");
980
987
  }
981
988
  };
@@ -985,12 +992,12 @@ function initJscadutils(_CSG, options = {}) {
985
992
  var t = calcCenterWith(self.combine(part, {
986
993
  noholes: true
987
994
  }), axis, to, delta);
988
- self.map((function(part) {
995
+ self.map(function(part) {
989
996
  return part.translate(t);
990
- }));
997
+ });
991
998
  return self;
992
999
  } catch (err) {
993
- debug("align error", this, part, to, axis, delta, err);
1000
+ debug$3("align error", this, part, to, axis, delta, err);
994
1001
  throw error('group::align error "'.concat(err.message || err.toString(), '"\nthis: ').concat(this, '\npart: "').concat(part, '"\nto: ').concat(to, '\naxis: "').concat(axis, '"\ndelta: "').concat(delta, '"\nstack: ').concat(err.stack, "\n"), "JSCAD_UTILS_GROUP_ERROR");
995
1002
  }
996
1003
  };
@@ -1006,7 +1013,7 @@ function initJscadutils(_CSG, options = {}) {
1006
1013
  JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
1007
1014
  var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1008
1015
  var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1009
- debug("connectTo", {
1016
+ debug$3("connectTo", {
1010
1017
  partName,
1011
1018
  connectorName,
1012
1019
  to,
@@ -1015,38 +1022,38 @@ function initJscadutils(_CSG, options = {}) {
1015
1022
  normalrotation
1016
1023
  });
1017
1024
  var self = this;
1018
- var myConnector = connectorName.split(".").reduce((function(a, v) {
1025
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1019
1026
  return a[v];
1020
- }), self.parts[partName].properties);
1021
- debug("toConnector", to instanceof CSG.Connector);
1022
- var toConnector = toConnectorName.split(".").reduce((function(a, v) {
1027
+ }, self.parts[partName].properties);
1028
+ debug$3("toConnector", to instanceof CSG.Connector);
1029
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1023
1030
  return a[v];
1024
- }), to.properties);
1031
+ }, to.properties);
1025
1032
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
1026
- debug("connectTo", matrix);
1027
- self.map((function(part) {
1033
+ debug$3("connectTo", matrix);
1034
+ self.map(function(part) {
1028
1035
  return part.transform(matrix);
1029
- }));
1036
+ });
1030
1037
  return self;
1031
1038
  };
1032
1039
  JsCadUtilsGroup.prototype.midlineTo = function midlineTo(part, axis, to) {
1033
1040
  var self = this;
1034
1041
  var size = self.combine(part).size();
1035
- var t = axisApply(axis, (function(i, a) {
1042
+ var t = axisApply(axis, function(i, a) {
1036
1043
  return to - size[a] / 2;
1037
- }));
1038
- self.map((function(part) {
1044
+ });
1045
+ self.map(function(part) {
1039
1046
  return part.translate(t);
1040
- }));
1047
+ });
1041
1048
  return self;
1042
1049
  };
1043
1050
  JsCadUtilsGroup.prototype.translate = function translate(x, y, z) {
1044
1051
  var self = this;
1045
1052
  var t = Array.isArray(x) ? x : [ x, y, z ];
1046
- debug("translate", t);
1047
- self.map((function(part) {
1053
+ debug$3("translate", t);
1054
+ self.map(function(part) {
1048
1055
  return part.translate(t);
1049
- }));
1056
+ });
1050
1057
  return self;
1051
1058
  };
1052
1059
  JsCadUtilsGroup.prototype.pick = function(parts, map) {
@@ -1054,9 +1061,9 @@ function initJscadutils(_CSG, options = {}) {
1054
1061
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1055
1062
  if (!map) map = identity;
1056
1063
  var g = Group();
1057
- p.forEach((function(name) {
1064
+ p.forEach(function(name) {
1058
1065
  g.add(map(CSG.fromPolygons(self.parts[name].toPolygons()), name), name);
1059
- }));
1066
+ });
1060
1067
  return g;
1061
1068
  };
1062
1069
  JsCadUtilsGroup.prototype.array = function(parts, map) {
@@ -1065,32 +1072,32 @@ function initJscadutils(_CSG, options = {}) {
1065
1072
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1066
1073
  if (!map) map = identity;
1067
1074
  var a = [];
1068
- p.forEach((function(name) {
1075
+ p.forEach(function(name) {
1069
1076
  if (!self.parts[name]) {
1070
- debug("array error", _this, parts);
1077
+ debug$3("array error", _this, parts);
1071
1078
  throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
1072
1079
  }
1073
1080
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
1074
- }));
1081
+ });
1075
1082
  return a;
1076
1083
  };
1077
1084
  JsCadUtilsGroup.prototype.toArray = function(pieces) {
1078
1085
  var self = this;
1079
1086
  var piecesArray = pieces ? pieces.split(",") : self.names;
1080
- return piecesArray.map((function(piece) {
1087
+ return piecesArray.map(function(piece) {
1081
1088
  if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
1082
1089
  return self.parts[piece];
1083
- }));
1090
+ });
1084
1091
  };
1085
1092
  JsCadUtilsGroup.prototype.toString = function() {
1086
- 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}');
1093
+ return '{\n name: "'.concat(this.name, '",\n names: "').concat(this.names.join(","), '", \n parts: "').concat(Object.keys(this.parts), '",\n holes: ').concat(Array.isArray(this.holes) ? this.holes.length : this.holes ? 1 : 0, "\n}");
1087
1094
  };
1088
1095
  JsCadUtilsGroup.prototype.setName = function(name) {
1089
1096
  this.name = name;
1090
1097
  return this;
1091
1098
  };
1092
1099
  function Group(objectNames, addObjects) {
1093
- debug("Group", objectNames, addObjects);
1100
+ debug$3("Group", objectNames, addObjects);
1094
1101
  var self = {
1095
1102
  name: "",
1096
1103
  names: [],
@@ -1113,9 +1120,9 @@ function initJscadutils(_CSG, options = {}) {
1113
1120
  self.name = objectNames;
1114
1121
  } else {
1115
1122
  var objects = objectNames;
1116
- self.names = Object.keys(objects).filter((function(k) {
1123
+ self.names = Object.keys(objects).filter(function(k) {
1117
1124
  return k !== "holes";
1118
- }));
1125
+ });
1119
1126
  self.parts = Object.assign({}, objects);
1120
1127
  self.holes = objects.holes;
1121
1128
  }
@@ -1123,7 +1130,7 @@ function initJscadutils(_CSG, options = {}) {
1123
1130
  }
1124
1131
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
1125
1132
  }
1126
- var debug$1 = Debug("jscadUtils:util");
1133
+ var debug$2 = Debug("jscadUtils:util");
1127
1134
  var NOZZEL_SIZE = .4;
1128
1135
  var nearest = {
1129
1136
  under: function under(desired) {
@@ -1158,7 +1165,7 @@ function initJscadutils(_CSG, options = {}) {
1158
1165
  return ((n = +n) || 1 / n) < 0;
1159
1166
  }
1160
1167
  function print(msg, o) {
1161
- debug$1(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1168
+ debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1162
1169
  }
1163
1170
  function jscadToString(o) {
1164
1171
  if (_typeof(o) == "object") {
@@ -1194,21 +1201,21 @@ function initJscadutils(_CSG, options = {}) {
1194
1201
  function label(text, x, y, width, height) {
1195
1202
  var l = vector_text(x || 0, y || 0, text);
1196
1203
  var o = [];
1197
- l.forEach((function(pl) {
1204
+ l.forEach(function(pl) {
1198
1205
  o.push(rectangular_extrude(pl, {
1199
1206
  w: width || 2,
1200
1207
  h: height || 2
1201
1208
  }));
1202
- }));
1209
+ });
1203
1210
  return center(union(o));
1204
1211
  }
1205
1212
  function text(text) {
1206
1213
  var l = vector_char(0, 0, text);
1207
- var _char = l.segments.reduce((function(result, segment) {
1214
+ var _char = l.segments.reduce(function(result, segment) {
1208
1215
  var path = new CSG.Path2D(segment);
1209
1216
  var cag = path.expandToCAG(2);
1210
1217
  return result ? result.union(cag) : cag;
1211
- }), undefined);
1218
+ }, undefined);
1212
1219
  return _char;
1213
1220
  }
1214
1221
  function unitCube(length, radius) {
@@ -1219,7 +1226,7 @@ function initJscadutils(_CSG, options = {}) {
1219
1226
  });
1220
1227
  }
1221
1228
  function unitAxis(length, radius, centroid) {
1222
- debug$1("unitAxis", length, radius, centroid);
1229
+ debug$2("unitAxis", length, radius, centroid);
1223
1230
  centroid = centroid || [ 0, 0, 0 ];
1224
1231
  var unitaxis = unitCube(length, radius).setColor(1, 0, 0).union([ unitCube(length, radius).rotateY(90).setColor(0, 1, 0), unitCube(length, radius).rotateX(90).setColor(0, 0, 1) ]);
1225
1232
  unitaxis.properties.origin = new CSG.Connector([ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ]);
@@ -1241,38 +1248,38 @@ function initJscadutils(_CSG, options = {}) {
1241
1248
  return result;
1242
1249
  }
1243
1250
  function zipObject(names, values) {
1244
- return names.reduce((function(result, value, idx) {
1251
+ return names.reduce(function(result, value, idx) {
1245
1252
  result[value] = values[idx];
1246
1253
  return result;
1247
- }), {});
1254
+ }, {});
1248
1255
  }
1249
1256
  function map(o, f) {
1250
- return Object.keys(o).map((function(key) {
1257
+ return Object.keys(o).map(function(key) {
1251
1258
  return f(o[key], key, o);
1252
- }));
1259
+ });
1253
1260
  }
1254
1261
  function mapValues(o, f) {
1255
- return Object.keys(o).map((function(key) {
1262
+ return Object.keys(o).map(function(key) {
1256
1263
  return f(o[key], key);
1257
- }));
1264
+ });
1258
1265
  }
1259
1266
  function pick(o, names) {
1260
- return names.reduce((function(result, name) {
1267
+ return names.reduce(function(result, name) {
1261
1268
  result[name] = o[name];
1262
1269
  return result;
1263
- }), {});
1270
+ }, {});
1264
1271
  }
1265
1272
  function mapPick(o, names, f, options) {
1266
- return names.reduce((function(result, name, index) {
1273
+ return names.reduce(function(result, name, index) {
1267
1274
  if (!o[name]) {
1268
1275
  throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
1269
1276
  }
1270
1277
  result.push(f ? f(o[name], name, index, o) : o[name]);
1271
1278
  return result;
1272
- }), []);
1279
+ }, []);
1273
1280
  }
1274
1281
  function divA(a, f) {
1275
- return div(a, f);
1282
+ return div$1(a, f);
1276
1283
  }
1277
1284
  function divxyz(size, x, y, z) {
1278
1285
  return {
@@ -1281,7 +1288,7 @@ function initJscadutils(_CSG, options = {}) {
1281
1288
  z: size.z / z
1282
1289
  };
1283
1290
  }
1284
- function div$1(size, d) {
1291
+ function div(size, d) {
1285
1292
  return this.divxyz(size, d, d, d);
1286
1293
  }
1287
1294
  function mulxyz(size, x, y, z) {
@@ -1333,9 +1340,9 @@ function initJscadutils(_CSG, options = {}) {
1333
1340
  var objectSize = size(object);
1334
1341
  var objectCentroid = centroid(object, objectSize);
1335
1342
  var idx = 0;
1336
- var t = map(objectSize, (function(i) {
1343
+ var t = map(objectSize, function(i) {
1337
1344
  return scale(i, a[idx++]);
1338
- }));
1345
+ });
1339
1346
  var new_object = object.scale(t);
1340
1347
  var new_centroid = centroid(new_object);
1341
1348
  var delta = new_centroid.minus(objectCentroid).times(-1);
@@ -1359,10 +1366,10 @@ function initJscadutils(_CSG, options = {}) {
1359
1366
  }
1360
1367
  var s = [ scale(objectSize.x, x), scale(objectSize.y, y), scale(objectSize.z, z) ];
1361
1368
  var min$1 = min(s);
1362
- return centerWith(object.scale(s.map((function(d, i) {
1369
+ return centerWith(object.scale(s.map(function(d, i) {
1363
1370
  if (a[i] === 0) return 1;
1364
1371
  return keep_aspect_ratio ? min$1 : d;
1365
- }))), "xyz", object);
1372
+ })), "xyz", object);
1366
1373
  }
1367
1374
  function shift(object, x, y, z) {
1368
1375
  var hsize = this.div(this.size(object.getBounds()), 2);
@@ -1401,9 +1408,9 @@ function initJscadutils(_CSG, options = {}) {
1401
1408
  if (side[0] === -1) {
1402
1409
  w[-1] = toxyz(withobj.centroid());
1403
1410
  }
1404
- return this.axisApply(axes, (function(i, axis) {
1411
+ return this.axisApply(axes, function(i, axis) {
1405
1412
  return w[side[0]][axis] - m[side[1]][axis];
1406
- }));
1413
+ });
1407
1414
  }
1408
1415
  function calcSnap(moveobj, withobj, axes, orientation) {
1409
1416
  var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
@@ -1424,15 +1431,15 @@ function initJscadutils(_CSG, options = {}) {
1424
1431
  if (side[0] === -1) {
1425
1432
  w[-1] = withobj.centroid();
1426
1433
  }
1427
- var t = axisApply(axes, (function(i, axis) {
1434
+ var t = axisApply(axes, function(i, axis) {
1428
1435
  return w[side[0]][axis] - m[side[1]][axis];
1429
- }));
1430
- return delta ? axisApply(axes, (function(i) {
1436
+ });
1437
+ return delta ? axisApply(axes, function(i) {
1431
1438
  return t[i] + delta;
1432
- })) : t;
1439
+ }) : t;
1433
1440
  }
1434
1441
  function snap(moveobj, withobj, axis, orientation, delta) {
1435
- debug$1("snap", moveobj, withobj, axis, orientation, delta);
1442
+ debug$2("snap", moveobj, withobj, axis, orientation, delta);
1436
1443
  var t = calcSnap(moveobj, withobj, axis, orientation, delta);
1437
1444
  return moveobj.translate(t);
1438
1445
  }
@@ -1440,16 +1447,16 @@ function initJscadutils(_CSG, options = {}) {
1440
1447
  return moveobj.translate(calcFlush(moveobj, withobj, axis, mside, wside));
1441
1448
  }
1442
1449
  function axisApply(axes, valfun, a) {
1443
- debug$1("axisApply", axes, valfun, a);
1450
+ debug$2("axisApply", axes, valfun, a);
1444
1451
  var retval = a || [ 0, 0, 0 ];
1445
1452
  var lookup = {
1446
1453
  x: 0,
1447
1454
  y: 1,
1448
1455
  z: 2
1449
1456
  };
1450
- axes.split("").forEach((function(axis) {
1457
+ axes.split("").forEach(function(axis) {
1451
1458
  retval[lookup[axis]] = valfun(lookup[axis], axis);
1452
- }));
1459
+ });
1453
1460
  return retval;
1454
1461
  }
1455
1462
  function axis2array(axes, valfun) {
@@ -1460,10 +1467,10 @@ function initJscadutils(_CSG, options = {}) {
1460
1467
  y: 1,
1461
1468
  z: 2
1462
1469
  };
1463
- axes.split("").forEach((function(axis) {
1470
+ axes.split("").forEach(function(axis) {
1464
1471
  var i = lookup[axis];
1465
1472
  a[i] = valfun(i, axis);
1466
- }));
1473
+ });
1467
1474
  return a;
1468
1475
  }
1469
1476
  function centroid(o, objectSize) {
@@ -1478,9 +1485,9 @@ function initJscadutils(_CSG, options = {}) {
1478
1485
  function calcmidlineTo(o, axis, to) {
1479
1486
  var bounds = o.getBounds();
1480
1487
  var objectSize = size(bounds);
1481
- return axisApply(axis, (function(i, a) {
1488
+ return axisApply(axis, function(i, a) {
1482
1489
  return to - objectSize[a] / 2;
1483
- }));
1490
+ });
1484
1491
  }
1485
1492
  function midlineTo(o, axis, to) {
1486
1493
  return o.translate(calcmidlineTo(o, axis, to));
@@ -1488,18 +1495,18 @@ function initJscadutils(_CSG, options = {}) {
1488
1495
  function translator(o, axis, withObj) {
1489
1496
  var objectCentroid = centroid(o);
1490
1497
  var withCentroid = centroid(withObj);
1491
- var t = axisApply(axis, (function(i) {
1498
+ var t = axisApply(axis, function(i) {
1492
1499
  return withCentroid[i] - objectCentroid[i];
1493
- }));
1500
+ });
1494
1501
  return t;
1495
1502
  }
1496
1503
  function calcCenterWith(o, axes, withObj) {
1497
1504
  var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1498
1505
  var objectCentroid = centroid(o);
1499
1506
  var withCentroid = centroid(withObj);
1500
- var t = axisApply(axes, (function(i, axis) {
1507
+ var t = axisApply(axes, function(i, axis) {
1501
1508
  return withCentroid[axis] - objectCentroid[axis];
1502
- }));
1509
+ });
1503
1510
  return delta ? add(t, delta) : t;
1504
1511
  }
1505
1512
  function centerWith(o, axis, withObj) {
@@ -1512,9 +1519,9 @@ function initJscadutils(_CSG, options = {}) {
1512
1519
  }
1513
1520
  }
1514
1521
  var dist = isNegative(offset) ? offset = size[axis] + offset : offset;
1515
- return axisApply(axis, (function(i, a) {
1522
+ return axisApply(axis, function(i, a) {
1516
1523
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1517
- }));
1524
+ });
1518
1525
  }
1519
1526
  function bisect() {
1520
1527
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -1577,14 +1584,14 @@ function initJscadutils(_CSG, options = {}) {
1577
1584
  }[[ axis, rotateaxis ].sort().join("")];
1578
1585
  var centroid = object.centroid();
1579
1586
  var rotateDelta = getDelta(objectSize, bounds, rotateOffsetAxis, rotateoffset);
1580
- var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", (function(i, a) {
1587
+ var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", function(i, a) {
1581
1588
  if (a == axis) return cutDelta[i];
1582
1589
  if (a == rotateOffsetAxis) return rotateDelta[i];
1583
1590
  return centroid[a];
1584
- })));
1591
+ }));
1585
1592
  var theRotationAxis = rotationAxes[rotateaxis];
1586
1593
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(info.orthoNormalCartesian[0], info.orthoNormalCartesian[1]).translate(cutDelta).rotate(rotationCenter, theRotationAxis, angle);
1587
- debug$1("bisect", debug$1.enabled && {
1594
+ debug$2("bisect", debug$2.enabled && {
1588
1595
  axis,
1589
1596
  offset,
1590
1597
  angle,
@@ -1665,15 +1672,18 @@ function initJscadutils(_CSG, options = {}) {
1665
1672
  return CSG.fromPolygons(polygons);
1666
1673
  }
1667
1674
  function slices2poly(slices, options, axis) {
1675
+ debug$2("slices2poly", slices, options, axis);
1676
+ options = Object.assign({
1677
+ twistangle: 0,
1678
+ twiststeps: 0
1679
+ }, options);
1668
1680
  var twistangle = options && parseFloat(options.twistangle) || 0;
1669
- var twiststeps = options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1670
- if (twistangle == 0 || twiststeps < 1) {
1671
- twiststeps = 1;
1672
- }
1681
+ options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1673
1682
  var normalVector = options.si.normalVector;
1674
1683
  var polygons = [];
1675
1684
  var first$1 = first(slices);
1676
1685
  var last$1 = last(slices);
1686
+ debug$2("slices2poly first", first$1, first$1.offset, "last", last$1);
1677
1687
  var up = first$1.offset[axis] > last$1.offset[axis];
1678
1688
  polygons = polygons.concat(first$1.poly._toPlanePolygons({
1679
1689
  translation: first$1.offset,
@@ -1692,7 +1702,7 @@ function initJscadutils(_CSG, options = {}) {
1692
1702
  return v[rotateAxis](angle * percent);
1693
1703
  };
1694
1704
  var connectorAxis = last$1.offset.minus(first$1.offset).abs();
1695
- slices.forEach((function(slice, idx) {
1705
+ slices.forEach(function(slice, idx) {
1696
1706
  if (idx < slices.length - 1) {
1697
1707
  var nextidx = idx + 1;
1698
1708
  var top = !up ? slices[nextidx] : slice;
@@ -1705,7 +1715,7 @@ function initJscadutils(_CSG, options = {}) {
1705
1715
  toConnector2: c2
1706
1716
  }));
1707
1717
  }
1708
- }));
1718
+ });
1709
1719
  return CSG.fromPolygons(polygons);
1710
1720
  }
1711
1721
  function normalVector(axis) {
@@ -1746,30 +1756,32 @@ function initJscadutils(_CSG, options = {}) {
1746
1756
  var info = dirInfo["dir" + direction];
1747
1757
  return Object.assign({
1748
1758
  axis,
1749
- cutDelta: axisApply(axis, (function(i, a) {
1759
+ cutDelta: axisApply(axis, function(i, a) {
1750
1760
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.sizeDir;
1751
- })),
1752
- moveDelta: axisApply(axis, (function(i, a) {
1761
+ }),
1762
+ moveDelta: axisApply(axis, function(i, a) {
1753
1763
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.moveDir;
1754
- }))
1764
+ })
1755
1765
  }, info, normalVector(axis));
1756
1766
  }
1757
1767
  function reShape(object, radius, orientation, options, slicer) {
1758
1768
  options = options || {};
1759
1769
  var b = object.getBounds();
1760
- var ar = Math.abs(radius);
1770
+ var absoluteRadius = Math.abs(radius);
1761
1771
  var si = sliceParams(orientation, radius, b);
1772
+ debug$2("reShape", absoluteRadius, si);
1762
1773
  if (si.axis !== "z") throw new Error('reShape error: CAG._toPlanePolytons only uses the "z" axis. You must use the "z" axis for now.');
1763
1774
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(si.orthoNormalCartesian[0], si.orthoNormalCartesian[1]).translate(si.cutDelta);
1764
1775
  var slice = object.sectionCut(cutplane);
1765
- var first = axisApply(si.axis, (function() {
1766
- return si.positive ? 0 : ar;
1767
- }));
1768
- var last = axisApply(si.axis, (function() {
1769
- return si.positive ? ar : 0;
1770
- }));
1776
+ var first = axisApply(si.axis, function() {
1777
+ return si.positive ? 0 : absoluteRadius;
1778
+ });
1779
+ var last = axisApply(si.axis, function() {
1780
+ return si.positive ? absoluteRadius : 0;
1781
+ });
1771
1782
  var plane = si.positive ? cutplane.plane : cutplane.plane.flipped();
1772
- var slices = slicer(first, last, slice);
1783
+ debug$2("reShape first/last", first, last);
1784
+ var slices = slicer(first, last, slice, radius);
1773
1785
  var delta = slices2poly(slices, Object.assign(options, {
1774
1786
  si
1775
1787
  }), si.axis).color(options.color);
@@ -1777,7 +1789,7 @@ function initJscadutils(_CSG, options = {}) {
1777
1789
  return union([ options.unionOriginal ? object : remainder, delta.translate(si.moveDelta) ]);
1778
1790
  }
1779
1791
  function chamfer(object, radius, orientation, options) {
1780
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1792
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1781
1793
  return [ {
1782
1794
  poly: slice,
1783
1795
  offset: new CSG.Vector3D(first)
@@ -1785,15 +1797,15 @@ function initJscadutils(_CSG, options = {}) {
1785
1797
  poly: enlarge(slice, [ -radius * 2, -radius * 2 ]),
1786
1798
  offset: new CSG.Vector3D(last)
1787
1799
  } ];
1788
- }));
1800
+ });
1789
1801
  }
1790
1802
  function fillet(object, radius, orientation, options) {
1791
1803
  options = options || {};
1792
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1804
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1793
1805
  var v1 = new CSG.Vector3D(first);
1794
1806
  var v2 = new CSG.Vector3D(last);
1795
1807
  var res = options.resolution || CSG.defaultResolution3D;
1796
- var slices = range(0, res).map((function(i) {
1808
+ var slices = range(0, res).map(function(i) {
1797
1809
  var p = i > 0 ? i / (res - 1) : 0;
1798
1810
  var v = v1.lerp(v2, p);
1799
1811
  var size = -radius * 2 - Math.cos(Math.asin(p)) * (-radius * 2);
@@ -1801,9 +1813,9 @@ function initJscadutils(_CSG, options = {}) {
1801
1813
  poly: enlarge(slice, [ size, size ]),
1802
1814
  offset: v
1803
1815
  };
1804
- }));
1816
+ });
1805
1817
  return slices;
1806
- }));
1818
+ });
1807
1819
  }
1808
1820
  function calcRotate(part, solid, axis) {
1809
1821
  var axes = {
@@ -1823,16 +1835,16 @@ function initJscadutils(_CSG, options = {}) {
1823
1835
  return part.rotate(rotationCenter, rotationAxis, angle);
1824
1836
  }
1825
1837
  function cloneProperties(from, to) {
1826
- return Object.entries(from).reduce((function(props, _ref) {
1838
+ return Object.entries(from).reduce(function(props, _ref) {
1827
1839
  var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1828
1840
  props[key] = value;
1829
1841
  return props;
1830
- }), to);
1842
+ }, to);
1831
1843
  }
1832
1844
  function clone(o) {
1833
1845
  var c = CSG.fromPolygons(o.toPolygons());
1834
1846
  cloneProperties(o, c);
1835
- debug$1("clone", o, c, CSG);
1847
+ debug$2("clone", o, c, CSG);
1836
1848
  return c;
1837
1849
  }
1838
1850
  function addConnector(object, name) {
@@ -1842,15 +1854,15 @@ function initJscadutils(_CSG, options = {}) {
1842
1854
  object.properties[name] = new CSG.Connector(point, axis, normal);
1843
1855
  return object;
1844
1856
  }
1845
- var debug$2 = Debug("jscadUtils:parts");
1857
+ var debug$1 = Debug("jscadUtils:parts");
1846
1858
  var parts = {
1847
- BBox,
1859
+ BBox: BBox$1,
1848
1860
  Cube,
1849
1861
  RoundedCube,
1850
1862
  Cylinder,
1851
1863
  Cone
1852
1864
  };
1853
- function BBox() {
1865
+ function BBox$1() {
1854
1866
  function box(object) {
1855
1867
  return CSG.cube({
1856
1868
  center: object.centroid(),
@@ -1860,13 +1872,13 @@ function initJscadutils(_CSG, options = {}) {
1860
1872
  for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1861
1873
  objects[_key] = arguments[_key];
1862
1874
  }
1863
- return objects.reduce((function(bbox, part) {
1875
+ return objects.reduce(function(bbox, part) {
1864
1876
  var object = bbox ? union([ bbox, box(part) ]) : part;
1865
1877
  return box(object);
1866
- }), undefined);
1878
+ }, undefined);
1867
1879
  }
1868
1880
  function Cube(width) {
1869
- var r = div(fromxyz(width), 2);
1881
+ var r = div$1(fromxyz(width), 2);
1870
1882
  return CSG.cube({
1871
1883
  center: r,
1872
1884
  radius: r
@@ -1881,7 +1893,7 @@ function initJscadutils(_CSG, options = {}) {
1881
1893
  } else {
1882
1894
  var r = [ x / 2, y / 2 ];
1883
1895
  }
1884
- debug$2("RoundedCube", size$1, r, thickness, corner_radius);
1896
+ debug$1("RoundedCube", size$1, r, thickness, corner_radius);
1885
1897
  var roundedcube = CAG.roundedRectangle({
1886
1898
  center: [ r[0], r[1], 0 ],
1887
1899
  radius: r,
@@ -1894,7 +1906,7 @@ function initJscadutils(_CSG, options = {}) {
1894
1906
  }
1895
1907
  function Cylinder(diameter, height) {
1896
1908
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1897
- debug$2("parts.Cylinder", diameter, height, options);
1909
+ debug$1("parts.Cylinder", diameter, height, options);
1898
1910
  options = Object.assign({
1899
1911
  start: [ 0, 0, 0 ],
1900
1912
  end: [ 0, 0, height ],
@@ -1905,7 +1917,7 @@ function initJscadutils(_CSG, options = {}) {
1905
1917
  }
1906
1918
  function Cone(diameter1, diameter2, height) {
1907
1919
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1908
- debug$2("parts.Cone", diameter1, diameter2, height, options);
1920
+ debug$1("parts.Cone", diameter1, diameter2, height, options);
1909
1921
  return CSG.cylinder(Object.assign({
1910
1922
  start: [ 0, 0, 0 ],
1911
1923
  end: [ 0, 0, height ],
@@ -1915,7 +1927,7 @@ function initJscadutils(_CSG, options = {}) {
1915
1927
  }, options));
1916
1928
  }
1917
1929
  function Hexagon(diameter, height) {
1918
- debug$2("hexagon", diameter, height);
1930
+ debug$1("hexagon", diameter, height);
1919
1931
  var radius = diameter / 2;
1920
1932
  var sqrt3 = Math.sqrt(3) / 2;
1921
1933
  var hex = CAG.fromPoints([ [ radius, 0 ], [ radius / 2, radius * sqrt3 ], [ -radius / 2, radius * sqrt3 ], [ -radius, 0 ], [ -radius / 2, -radius * sqrt3 ], [ radius / 2, -radius * sqrt3 ] ]);
@@ -2013,7 +2025,7 @@ function initJscadutils(_CSG, options = {}) {
2013
2025
  var parts$1 = Object.freeze({
2014
2026
  __proto__: null,
2015
2027
  default: parts,
2016
- BBox,
2028
+ BBox: BBox$1,
2017
2029
  Cube,
2018
2030
  RoundedCube,
2019
2031
  Cylinder,
@@ -2025,13 +2037,13 @@ function initJscadutils(_CSG, options = {}) {
2025
2037
  Board,
2026
2038
  Hardware
2027
2039
  });
2028
- var debug$3 = Debug("jscadUtils:boxes");
2040
+ var debug = Debug("jscadUtils:boxes");
2029
2041
  function RabbetJoin(box, thickness, cutHeight) {
2030
2042
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
2031
2043
  return rabbetJoin(box, thickness, cutHeight);
2032
2044
  }
2033
2045
  function topMiddleBottom(box, thickness) {
2034
- debug$3("TopMiddleBottom", box, thickness);
2046
+ debug("TopMiddleBottom", box, thickness);
2035
2047
  var bottom = box.bisect("z", thickness, {
2036
2048
  color: true
2037
2049
  });
@@ -2040,20 +2052,21 @@ function initJscadutils(_CSG, options = {}) {
2040
2052
  }
2041
2053
  function Rabett(box, thickness, gap, height, face) {
2042
2054
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2043
- debug$3("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2055
+ debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2044
2056
  gap = gap || .25;
2045
2057
  var inside = thickness - gap;
2046
2058
  var outside = -thickness + gap;
2047
- options.color = true;
2059
+ debug("inside", inside, "outside", outside);
2048
2060
  var group = Group();
2049
- debug$3("Rabbet top height:", height, "options:", options);
2050
2061
  var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
2051
- debug$3("face", face, "height", height);
2052
2062
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
2053
- debug$3("Rabbet bottom height:", lowerBisectHeight, "options:", options);
2054
2063
  var _lower2_3rd$bisect$pa = lower2_3rd.bisect("z", lowerBisectHeight, options).parts, middle = _lower2_3rd$bisect$pa.positive, bottom = _lower2_3rd$bisect$pa.negative;
2055
- group.add(top.union(middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]))), "top");
2056
- group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ]))), "bottom");
2064
+ var middleTop = middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]));
2065
+ group.add(top.union(middleTop), "top");
2066
+ var bottomOutline = middle.color("yellow").subtract(middle.color("orange").enlarge([ outside, outside, 0 ])).enlarge([ outside, outside, 0 ]);
2067
+ group.add(bottomOutline, "middle-top", true);
2068
+ group.add(middle.color("green").subtract(middle.color("pink").enlarge([ inside, inside, 0 ])), "middle-bottom", true);
2069
+ group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ])).subtract(middleTop)), "bottom");
2057
2070
  return group;
2058
2071
  }
2059
2072
  var RabettTopBottom = function rabbetTMB(box, thickness) {
@@ -2065,7 +2078,7 @@ function initJscadutils(_CSG, options = {}) {
2065
2078
  topWidth: -thickness,
2066
2079
  bottomWidth: thickness
2067
2080
  }, options);
2068
- debug$3("RabettTopBottom", box, thickness, gap, options);
2081
+ debug("RabettTopBottom", box, thickness, gap, options);
2069
2082
  var group = Group("", {
2070
2083
  box
2071
2084
  });
@@ -2111,7 +2124,7 @@ function initJscadutils(_CSG, options = {}) {
2111
2124
  };
2112
2125
  var Rectangle = function Rectangle(size, thickness, cb) {
2113
2126
  thickness = thickness || 2;
2114
- var s = div(xyz2array(size), 2);
2127
+ var s = div$1(xyz2array(size), 2);
2115
2128
  var r = add(s, thickness);
2116
2129
  var box = CSG.cube({
2117
2130
  center: r,
@@ -2131,16 +2144,16 @@ function initJscadutils(_CSG, options = {}) {
2131
2144
  if (exteriorcb) box = exteriorcb(box);
2132
2145
  return box;
2133
2146
  };
2134
- var BBox$1 = function BBox(o) {
2147
+ var BBox = function BBox(o) {
2135
2148
  depreciated("BBox", true, "Use 'parts.BBox' instead");
2136
- var s = div(xyz2array(o.size()), 2);
2149
+ var s = div$1(xyz2array(o.size()), 2);
2137
2150
  return CSG.cube({
2138
2151
  center: s,
2139
2152
  radius: s
2140
2153
  }).align(o, "xyz");
2141
2154
  };
2142
2155
  function getRadius(o) {
2143
- return div(xyz2array(o.size()), 2);
2156
+ return div$1(xyz2array(o.size()), 2);
2144
2157
  }
2145
2158
  function rabbetJoin(box, thickness) {
2146
2159
  var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
@@ -2168,7 +2181,7 @@ function initJscadutils(_CSG, options = {}) {
2168
2181
  CutOut,
2169
2182
  Rectangle,
2170
2183
  Hollow,
2171
- BBox: BBox$1
2184
+ BBox
2172
2185
  });
2173
2186
  var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
2174
2187
  group: Group,
@@ -2188,6 +2201,9 @@ function initJscadutils(_CSG, options = {}) {
2188
2201
  exports.parts = parts$1;
2189
2202
  exports.triUtils = triUtils;
2190
2203
  exports.util = util;
2204
+ Object.defineProperty(exports, "__esModule", {
2205
+ value: true
2206
+ });
2191
2207
  return exports;
2192
2208
  }({}, jsCadCSG, scadApi);
2193
2209
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
@@ -2253,15 +2269,14 @@ function initJscadRPi() {
2253
2269
  };
2254
2270
  var jscadRPi = function(exports, jscadUtils, jsCadCSG, scadApi) {
2255
2271
  "use strict";
2256
- function _interopDefaultLegacy(e) {
2257
- return e && typeof e === "object" && "default" in e ? e : {
2258
- default: e
2259
- };
2272
+ function activeCoolingFan() {
2273
+ var g = jscadUtils.Group("ActiveCoolingFan");
2274
+ 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"));
2275
+ g.add(board, "board");
2276
+ return g;
2260
2277
  }
2261
- var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
2262
- var scadApi__default = _interopDefaultLegacy(scadApi);
2263
- var CSG$1 = jsCadCSG__default["default"].CSG;
2264
- var union = scadApi__default["default"].booleanOps.union;
2278
+ jsCadCSG.CSG;
2279
+ scadApi.booleanOps.union;
2265
2280
  function RightSide(o, mb) {
2266
2281
  return o.translate(jscadUtils.array.add(o.calcSnap(mb, "z", "outside-"), o.calcSnap(mb, "x", "inside+"), o.calcSnap(mb, "y", "inside-"), [ 2, 0, 0 ]));
2267
2282
  }
@@ -2326,13 +2341,13 @@ function initJscadRPi() {
2326
2341
  function BoardLed() {
2327
2342
  return jscadUtils.parts.Cube([ 1, 2, .7 ]);
2328
2343
  }
2329
- var debug = jscadUtils.Debug("jscadRPi:BPlusMounting");
2344
+ var debug$2 = jscadUtils.Debug("jscadRPi:BPlusMounting");
2330
2345
  function holes(mb) {
2331
2346
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2332
2347
  options = Object.assign(options, {
2333
2348
  height: 8
2334
2349
  });
2335
- debug("holes", mb, options);
2350
+ debug$2("holes", mb, options);
2336
2351
  var hole = MountingHole(options.diameter || 3.25, options.height).snap(mb, "xy", "inside-").align(mb, "z");
2337
2352
  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) ];
2338
2353
  return jscadUtils.Group("hole1,hole2,hole3,hole4", holes);
@@ -2377,6 +2392,8 @@ function initJscadRPi() {
2377
2392
  group.add(BoardLed().snap(mb, "z", "outside-").midlineTo("x", 1.1).midlineTo("y", 12).color("red"), "powerled");
2378
2393
  }
2379
2394
  function pi5(group, clearance, mb) {
2395
+ group.add(jscadUtils.parts.Cube([ 12, 12, 3 ]).color("lightgray").translate([ 24, 15, 2 ]), "cpu");
2396
+ group.add(jscadUtils.parts.Cube([ 12, 12, clearance ]).color("red").translate([ 24, 15, 2 ]), "clearance-cpu", true, "clearance");
2380
2397
  group.add(RightSide(jscadUtils.parts.Cube([ 21.5, 16.5, 13.5 ]).color("lightgray"), mb).translate([ 2, 0, 0 ]).midlineTo("y", 10.2), "ethernet");
2381
2398
  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");
2382
2399
  var usb = jscadUtils.Group();
@@ -2442,9 +2459,15 @@ function initJscadRPi() {
2442
2459
  group.add(group.holes[1], "hole2", true);
2443
2460
  group.add(group.holes[2], "hole3", true);
2444
2461
  group.add(group.holes[3], "hole4", true);
2462
+ if (model >= 5) {
2463
+ group.holes.push(MountingHole(3.25, 8).snap(mb, "xy", "inside-").align(mb, "z").midlineTo("x", 3.5).midlineTo("y", 6 + 3.5));
2464
+ group.add(group.holes[4], "fan1hole", true);
2465
+ group.holes.push(MountingHole(3.25, 8).snap(mb, "xy", "inside-").align(mb, "z").midlineTo("x", 3.5 + 58).midlineTo("y", 52.5 - 6));
2466
+ group.add(group.holes[5], "fan2hole", true);
2467
+ }
2445
2468
  return group;
2446
2469
  }
2447
- function CameraModuleV1() {
2470
+ function CameraModuleV1$1() {
2448
2471
  var t = 1.1;
2449
2472
  var height = {
2450
2473
  sensor: 5.9 - t,
@@ -2457,27 +2480,27 @@ function initJscadRPi() {
2457
2480
  }
2458
2481
  g.holes = [ Hole(2, 2).color("yellow"), Hole(2, 23), Hole(12.5 + 2, 2), Hole(12.5 + 2, 23) ];
2459
2482
  g.add(jscadUtils.Group("hole0,hole1,hole2,hole3", g.holes), "hole", false, "holes");
2460
- var mounts = g.holes.reduce((function(m, h, i) {
2483
+ var mounts = g.holes.reduce(function(m, h, i) {
2461
2484
  m["mount".concat(i)] = jscadUtils.parts.Cylinder(4, 2).align(h, "xy").snap(g.parts.board, "z", "outside-");
2462
2485
  return m;
2463
- }), {});
2486
+ }, {});
2464
2487
  g.add(jscadUtils.Group(mounts), "mounts", true, "mounts");
2465
- var pins = g.holes.reduce((function(m, h, i) {
2488
+ var pins = g.holes.reduce(function(m, h, i) {
2466
2489
  m["pin".concat(i)] = jscadUtils.parts.Cylinder(jscadUtils.util.nearest.under(1.5), height.board).align(h, "xy").align(g.parts.board, "z");
2467
2490
  return m;
2468
- }), {});
2491
+ }, {});
2469
2492
  g.add(jscadUtils.Group(pins), "pins", true, "pins");
2470
2493
  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");
2471
2494
  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");
2472
2495
  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");
2473
2496
  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");
2474
- 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) {
2497
+ 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) {
2475
2498
  return hole.enlarge(3, 3, 5);
2476
- }))).color("red"), "bottom-nogo");
2499
+ })).color("red"), "bottom-nogo");
2477
2500
  g.add(g.parts.ribbon.enlarge(2, -1, -1).snap(g.parts.ribbon, "x", "outside-").color("red"), "ribbon-nogo");
2478
2501
  return g;
2479
2502
  }
2480
- function CameraModuleV1$1() {
2503
+ function CameraModuleV1() {
2481
2504
  var t = 1.1;
2482
2505
  var height = {
2483
2506
  sensor: 4 - t,
@@ -2490,23 +2513,23 @@ function initJscadRPi() {
2490
2513
  }
2491
2514
  g.holes = [ Hole(2, 2).color("yellow"), Hole(2, 23), Hole(14.5, 2), Hole(14.5, 23) ];
2492
2515
  g.add(jscadUtils.Group("hole0,hole1,hole2,hole3", g.holes), "hole", false, "holes");
2493
- var mounts = g.holes.reduce((function(m, h, i) {
2516
+ var mounts = g.holes.reduce(function(m, h, i) {
2494
2517
  m["mount".concat(i)] = jscadUtils.parts.Cylinder(4, height.sensor).align(h, "xy").snap(g.parts.board, "z", "outside-");
2495
2518
  return m;
2496
- }), {});
2519
+ }, {});
2497
2520
  g.add(jscadUtils.Group(mounts), "mounts", true, "mounts");
2498
- var pins = g.holes.reduce((function(m, h, i) {
2521
+ var pins = g.holes.reduce(function(m, h, i) {
2499
2522
  m["pin".concat(i)] = jscadUtils.parts.Cylinder(jscadUtils.util.nearest.under(1.5), height.board).align(h, "xy").align(g.parts.board, "z");
2500
2523
  return m;
2501
- }), {});
2524
+ }, {});
2502
2525
  g.add(jscadUtils.Group(pins), "pins", true, "pins");
2503
2526
  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");
2504
2527
  g.add(jscadUtils.parts.Cylinder(7.3, 1.6).align(g.parts.sensor, "xy").snap(g.parts.sensor, "z", "outside-").color("gray"), "lense");
2505
2528
  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");
2506
2529
  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");
2507
- 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) {
2530
+ 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) {
2508
2531
  return hole.enlarge(3, 3, 5);
2509
- }))).color("red"), "bottom-nogo");
2532
+ })).color("red"), "bottom-nogo");
2510
2533
  g.add(g.parts.ribbon.enlarge(2, -1, -1).snap(g.parts.ribbon, "x", "outside-").color("red"), "ribbon-nogo");
2511
2534
  return g;
2512
2535
  }
@@ -2532,31 +2555,30 @@ function initJscadRPi() {
2532
2555
  var peg = MountingHole(null, options.height + 3);
2533
2556
  return standoff.union(peg);
2534
2557
  }
2535
- function _toConsumableArray(arr) {
2536
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
2537
- }
2538
- function _arrayWithoutHoles(arr) {
2539
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
2558
+ function _arrayLikeToArray(r, a) {
2559
+ (null == a || a > r.length) && (a = r.length);
2560
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2561
+ return n;
2540
2562
  }
2541
- function _iterableToArray(iter) {
2542
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
2563
+ function _arrayWithoutHoles(r) {
2564
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
2543
2565
  }
2544
- function _unsupportedIterableToArray(o, minLen) {
2545
- if (!o) return;
2546
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2547
- var n = Object.prototype.toString.call(o).slice(8, -1);
2548
- if (n === "Object" && o.constructor) n = o.constructor.name;
2549
- if (n === "Map" || n === "Set") return Array.from(o);
2550
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2551
- }
2552
- function _arrayLikeToArray(arr, len) {
2553
- if (len == null || len > arr.length) len = arr.length;
2554
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
2555
- return arr2;
2566
+ function _iterableToArray(r) {
2567
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2556
2568
  }
2557
2569
  function _nonIterableSpread() {
2558
2570
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2559
2571
  }
2572
+ function _toConsumableArray(r) {
2573
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
2574
+ }
2575
+ function _unsupportedIterableToArray(r, a) {
2576
+ if (r) {
2577
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
2578
+ var t = {}.toString.call(r).slice(8, -1);
2579
+ 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;
2580
+ }
2581
+ }
2560
2582
  function HQCameraModule() {
2561
2583
  var _camera$holes;
2562
2584
  var t = 1.1;
@@ -2627,8 +2649,8 @@ function initJscadRPi() {
2627
2649
  group.add(buttons[3], "button4");
2628
2650
  return group;
2629
2651
  }
2630
- var union$2 = scadApi.booleanOps.union;
2631
- var debug$2 = jscadUtils.Debug("jscadRPi:PiTFT24");
2652
+ var union = scadApi.booleanOps.union;
2653
+ var debug = jscadUtils.Debug("jscadRPi:PiTFT24");
2632
2654
  function PiTFT24() {
2633
2655
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2634
2656
  var pi = arguments.length > 1 ? arguments[1] : undefined;
@@ -2639,7 +2661,7 @@ function initJscadRPi() {
2639
2661
  buttonWireYOffset: 5,
2640
2662
  clearance: .9
2641
2663
  });
2642
- debug$2("PiTFT24", options);
2664
+ debug("PiTFT24", options);
2643
2665
  var hat = Hat(pi);
2644
2666
  var mb = hat.parts.mb;
2645
2667
  var group = jscadUtils.Group();
@@ -2653,36 +2675,36 @@ function initJscadRPi() {
2653
2675
  group.add(lcdbevel.translate(lcdbevel.calcSnap(mb, "xy", "inside-")).translate(lcdbevel.calcSnap(mb, "z", "outside-")).translate([ 4.5, 7, 0 ]), "lcdbevel");
2654
2676
  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);
2655
2677
  var button = buttonBase.union(jscadUtils.parts.Cube([ 3, 1.5, .5 ]).color("white").snap(buttonBase, "z", "outside-").align(buttonBase, "xy"));
2656
- var buttons = [ 12.39, 12.39 + 10, 12.39 + 20, 12.39 + 30, 12.39 + 40 ].map((function(midpoint) {
2678
+ var buttons = [ 12.39, 12.39 + 10, 12.39 + 20, 12.39 + 30, 12.39 + 40 ].map(function(midpoint) {
2657
2679
  return button.midlineTo("x", midpoint);
2658
- }));
2680
+ });
2659
2681
  group.add(jscadUtils.Group("1,2,3,4,5", buttons), "buttons", false, "button");
2660
2682
  var capBaseHeight = options.capBaseHeight;
2661
2683
  var buttonCapBase = jscadUtils.parts.Cube([ 6.6, 4, capBaseHeight ]).color("blue");
2662
2684
  var buttonCapTop = jscadUtils.parts.Cube([ 6.1, 3.5, options.buttonCapHeight - capBaseHeight ]).snap(buttonCapBase, "z", "outside-").align(buttonCapBase, "xy").fillet(1, "z+").color("deepskyblue");
2663
- var buttonCaps = buttons.map((function(button) {
2664
- return union$2([ buttonCapBase, buttonCapTop ]).snap(button, "z", "outside-").align(button, "xy");
2665
- }));
2666
- group.add(union$2(buttonCaps), "buttonCaps", hiddenPart);
2667
- group.add(union$2(buttonCaps.map((function(button) {
2668
- 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 ]) ]);
2669
- }))), "buttonCapClearance", hiddenPart);
2685
+ var buttonCaps = buttons.map(function(button) {
2686
+ return union([ buttonCapBase, buttonCapTop ]).snap(button, "z", "outside-").align(button, "xy");
2687
+ });
2688
+ group.add(union(buttonCaps), "buttonCaps", hiddenPart);
2689
+ group.add(union(buttonCaps.map(function(button) {
2690
+ 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 ]) ]);
2691
+ })), "buttonCapClearance", hiddenPart);
2670
2692
  var bwthickness = options.capBaseHeight;
2671
2693
  var connector = LeftSide(jscadUtils.parts.Cube([ bwthickness, options.buttonWireYOffset, bwthickness ]), mb).snap(buttonCaps[0], "z", "inside-").snap(buttonCaps[0], "y", "outside+").color("blue");
2672
2694
  var buttonWire = jscadUtils.parts.Cube([ 40, bwthickness, bwthickness ]).snap(buttonCaps[0], "x", "center-").snap(buttonCaps[0], "z", "inside-").snap(connector, "y", "inside-").color("blue");
2673
- group.add(union$2(buttonWire), "buttonWire", hiddenPart);
2674
- var buttonWireConnector = buttonCaps.map((function(buttonCap) {
2695
+ group.add(union(buttonWire), "buttonWire", hiddenPart);
2696
+ var buttonWireConnector = buttonCaps.map(function(buttonCap) {
2675
2697
  return connector.align(buttonCap, "x");
2676
- }));
2677
- group.add(union$2(buttonWireConnector), "buttonWireConnector", hiddenPart);
2678
- var buttonWireClearance = union$2(buttonWireConnector.map((function(connector) {
2698
+ });
2699
+ group.add(union(buttonWireConnector), "buttonWireConnector", hiddenPart);
2700
+ var buttonWireClearance = union(buttonWireConnector.map(function(connector) {
2679
2701
  return connector.enlarge([ options.clearance, options.clearance, options.buttonCapHeight ]);
2680
- }))).union(buttonWire.enlarge([ options.clearance, options.clearance, options.buttonCapHeight ])).snap(buttonWire, "z", "inside+").color("red");
2702
+ })).union(buttonWire.enlarge([ options.clearance, options.clearance, options.buttonCapHeight ])).snap(buttonWire, "z", "inside+").color("red");
2681
2703
  group.add(buttonWireClearance, "buttonWireClearance", hiddenPart);
2682
2704
  group.add(jscadUtils.parts.Cube([ 15, 33, 7 ]).snap(mb, "x", "inside-").snap(mb, "z", "outside+").align(mb, "y").color("red"), "gpio2", hiddenPart);
2683
2705
  return group;
2684
2706
  }
2685
- var debug$3 = jscadUtils.Debug("jscadRPi:Spacer");
2707
+ jscadUtils.Debug("jscadRPi:Spacer");
2686
2708
  function Spacer() {
2687
2709
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2688
2710
  var mb = arguments.length > 1 ? arguments[1] : undefined;
@@ -2718,9 +2740,10 @@ function initJscadRPi() {
2718
2740
  var assembly = spacers.union(gusset.unionIf(cross, !options.hollow).translate([ 0, 0, -options.offset ])).subtractIf(gpio.enlarge([ 1, 1, 0 ]), options.gpio);
2719
2741
  return assembly.color("yellow");
2720
2742
  }
2743
+ exports.ActiveCoolingFan = activeCoolingFan;
2721
2744
  exports.BPlus = BPlus;
2722
- exports.CameraModuleV1 = CameraModuleV1;
2723
- exports.CameraModuleV2 = CameraModuleV1$1;
2745
+ exports.CameraModuleV1 = CameraModuleV1$1;
2746
+ exports.CameraModuleV2 = CameraModuleV1;
2724
2747
  exports.HQCameraModule = HQCameraModule;
2725
2748
  exports.Hat = Hat;
2726
2749
  exports.HatStandoff = HatStandoff;