@jwc/jscad-utils 4.8.3 → 4.9.0

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.
@@ -148,7 +148,7 @@ function initJscadutils(_CSG, options = {}) {
148
148
  return divxyz;
149
149
  },
150
150
  get div() {
151
- return div$1;
151
+ return div;
152
152
  },
153
153
  get mulxyz() {
154
154
  return mulxyz;
@@ -280,104 +280,98 @@ function initJscadutils(_CSG, options = {}) {
280
280
  return addConnector;
281
281
  }
282
282
  });
283
- function _typeof(obj) {
284
- "@babel/helpers - typeof";
285
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
286
- _typeof = function(obj) {
287
- return typeof obj;
288
- };
289
- } else {
290
- _typeof = function(obj) {
291
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
292
- };
293
- }
294
- return _typeof(obj);
295
- }
296
- function _defineProperty(obj, key, value) {
297
- if (key in obj) {
298
- Object.defineProperty(obj, key, {
299
- value,
300
- enumerable: true,
301
- configurable: true,
302
- writable: true
303
- });
304
- } else {
305
- obj[key] = value;
306
- }
307
- return obj;
308
- }
309
- function ownKeys(object, enumerableOnly) {
310
- var keys = Object.keys(object);
311
- if (Object.getOwnPropertySymbols) {
312
- var symbols = Object.getOwnPropertySymbols(object);
313
- if (enumerableOnly) symbols = symbols.filter((function(sym) {
314
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
315
- }));
316
- keys.push.apply(keys, symbols);
317
- }
318
- return keys;
319
- }
320
- function _objectSpread2(target) {
321
- for (var i = 1; i < arguments.length; i++) {
322
- var source = arguments[i] != null ? arguments[i] : {};
323
- if (i % 2) {
324
- ownKeys(Object(source), true).forEach((function(key) {
325
- _defineProperty(target, key, source[key]);
326
- }));
327
- } else if (Object.getOwnPropertyDescriptors) {
328
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
329
- } else {
330
- ownKeys(Object(source)).forEach((function(key) {
331
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
332
- }));
283
+ function _arrayLikeToArray(r, a) {
284
+ (null == a || a > r.length) && (a = r.length);
285
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
286
+ return n;
287
+ }
288
+ function _arrayWithHoles(r) {
289
+ if (Array.isArray(r)) return r;
290
+ }
291
+ function _defineProperty(e, r, t) {
292
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
293
+ value: t,
294
+ enumerable: !0,
295
+ configurable: !0,
296
+ writable: !0
297
+ }) : e[r] = t, e;
298
+ }
299
+ function _iterableToArrayLimit(r, l) {
300
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
301
+ if (null != t) {
302
+ var e, n, i, u, a = [], f = !0, o = !1;
303
+ try {
304
+ if (i = (t = t.call(r)).next, 0 === l) {
305
+ if (Object(t) !== t) return;
306
+ f = !1;
307
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
308
+ } catch (r) {
309
+ o = !0, n = r;
310
+ } finally {
311
+ try {
312
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
313
+ } finally {
314
+ if (o) throw n;
315
+ }
333
316
  }
317
+ return a;
334
318
  }
335
- return target;
336
319
  }
337
- function _slicedToArray(arr, i) {
338
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
339
- }
340
- function _arrayWithHoles(arr) {
341
- if (Array.isArray(arr)) return arr;
320
+ function _nonIterableRest() {
321
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
342
322
  }
343
- function _iterableToArrayLimit(arr, i) {
344
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
345
- var _arr = [];
346
- var _n = true;
347
- var _d = false;
348
- var _e = undefined;
349
- try {
350
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
351
- _arr.push(_s.value);
352
- if (i && _arr.length === i) break;
353
- }
354
- } catch (err) {
355
- _d = true;
356
- _e = err;
357
- } finally {
358
- try {
359
- if (!_n && _i["return"] != null) _i["return"]();
360
- } finally {
361
- if (_d) throw _e;
362
- }
323
+ function ownKeys(e, r) {
324
+ var t = Object.keys(e);
325
+ if (Object.getOwnPropertySymbols) {
326
+ var o = Object.getOwnPropertySymbols(e);
327
+ r && (o = o.filter(function(r) {
328
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
329
+ })), t.push.apply(t, o);
363
330
  }
364
- return _arr;
331
+ return t;
365
332
  }
366
- function _unsupportedIterableToArray(o, minLen) {
367
- if (!o) return;
368
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
369
- var n = Object.prototype.toString.call(o).slice(8, -1);
370
- if (n === "Object" && o.constructor) n = o.constructor.name;
371
- if (n === "Map" || n === "Set") return Array.from(o);
372
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
333
+ function _objectSpread2(e) {
334
+ for (var r = 1; r < arguments.length; r++) {
335
+ var t = null != arguments[r] ? arguments[r] : {};
336
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
337
+ _defineProperty(e, r, t[r]);
338
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
339
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
340
+ });
341
+ }
342
+ return e;
343
+ }
344
+ function _slicedToArray(r, e) {
345
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
346
+ }
347
+ function _toPrimitive(t, r) {
348
+ if ("object" != typeof t || !t) return t;
349
+ var e = t[Symbol.toPrimitive];
350
+ if (void 0 !== e) {
351
+ var i = e.call(t, r || "default");
352
+ if ("object" != typeof i) return i;
353
+ throw new TypeError("@@toPrimitive must return a primitive value.");
354
+ }
355
+ return ("string" === r ? String : Number)(t);
373
356
  }
374
- function _arrayLikeToArray(arr, len) {
375
- if (len == null || len > arr.length) len = arr.length;
376
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
377
- return arr2;
357
+ function _toPropertyKey(t) {
358
+ var i = _toPrimitive(t, "string");
359
+ return "symbol" == typeof i ? i : i + "";
378
360
  }
379
- function _nonIterableRest() {
380
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
361
+ function _typeof(o) {
362
+ "@babel/helpers - typeof";
363
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
364
+ return typeof o;
365
+ } : function(o) {
366
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
367
+ }, _typeof(o);
368
+ }
369
+ function _unsupportedIterableToArray(r, a) {
370
+ if (r) {
371
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
372
+ var t = {}.toString.call(r).slice(8, -1);
373
+ 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;
374
+ }
381
375
  }
382
376
  var toRadians = function toRadians(deg) {
383
377
  return deg / 180 * Math.PI;
@@ -437,30 +431,30 @@ function initJscadutils(_CSG, options = {}) {
437
431
  solve90ac,
438
432
  solveab
439
433
  });
440
- var div = function div(a, f) {
441
- return a.map((function(e) {
434
+ var div$1 = function div(a, f) {
435
+ return a.map(function(e) {
442
436
  return e / f;
443
- }));
437
+ });
444
438
  };
445
439
  var addValue = function addValue(a, f) {
446
- return a.map((function(e) {
440
+ return a.map(function(e) {
447
441
  return e + f;
448
- }));
442
+ });
449
443
  };
450
444
  var addArray = function addArray(a, f) {
451
- return a.map((function(e, i) {
445
+ return a.map(function(e, i) {
452
446
  return e + f[i];
453
- }));
447
+ });
454
448
  };
455
449
  var add = function add(a) {
456
- return Array.prototype.slice.call(arguments, 1).reduce((function(result, arg) {
450
+ return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
457
451
  if (Array.isArray(arg)) {
458
452
  result = addArray(result, arg);
459
453
  } else {
460
454
  result = addValue(result, arg);
461
455
  }
462
456
  return result;
463
- }), a);
457
+ }, a);
464
458
  };
465
459
  var fromxyz = function fromxyz(object) {
466
460
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
@@ -479,9 +473,9 @@ function initJscadutils(_CSG, options = {}) {
479
473
  return a && a.length > 0 ? a[a.length - 1] : undefined;
480
474
  };
481
475
  var min = function min(a) {
482
- return a.reduce((function(result, value) {
476
+ return a.reduce(function(result, value) {
483
477
  return value < result ? value : result;
484
- }), Number.MAX_VALUE);
478
+ }, Number.MAX_VALUE);
485
479
  };
486
480
  var range = function range(a, b) {
487
481
  var result = [];
@@ -492,7 +486,7 @@ function initJscadutils(_CSG, options = {}) {
492
486
  };
493
487
  var array = Object.freeze({
494
488
  __proto__: null,
495
- div,
489
+ div: div$1,
496
490
  addValue,
497
491
  addArray,
498
492
  add,
@@ -515,11 +509,11 @@ function initJscadutils(_CSG, options = {}) {
515
509
  }
516
510
  }, jscadUtilsDebug || {});
517
511
  var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
518
- var enabled = checks.enabled.some((function checkEnabled(check) {
512
+ var enabled = checks.enabled.some(function checkEnabled(check) {
519
513
  return check.test(name);
520
- })) && !checks.disabled.some((function checkEnabled(check) {
514
+ }) && !checks.disabled.some(function checkEnabled(check) {
521
515
  return check.test(name);
522
- }));
516
+ });
523
517
  var logger = enabled ? checks.options.browser ? function() {
524
518
  var _console;
525
519
  for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -706,9 +700,9 @@ function initJscadutils(_CSG, options = {}) {
706
700
  function color(o, r, g, b, a) {
707
701
  if (typeof r !== "string") return o.setColor(r, g, b, a);
708
702
  if (r === "") return o;
709
- var c = name2rgb(r).map((function(x) {
703
+ var c = name2rgb(r).map(function(x) {
710
704
  return x / 255;
711
- }));
705
+ });
712
706
  c[3] = g || 1;
713
707
  return o.setColor(c);
714
708
  }
@@ -810,10 +804,10 @@ function initJscadutils(_CSG, options = {}) {
810
804
  if (arguments.length === 1) {
811
805
  return this._translate(arguments[0]);
812
806
  } else {
813
- var t = Array.prototype.slice.call(arguments, 0).reduce((function(result, arg) {
807
+ var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
814
808
  result = undefined(result, arg);
815
809
  return result;
816
- }), [ 0, 0, 0 ]);
810
+ }, [ 0, 0, 0 ]);
817
811
  return this._translate(t);
818
812
  }
819
813
  };
@@ -823,9 +817,9 @@ function initJscadutils(_CSG, options = {}) {
823
817
  proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
824
818
  var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
825
819
  var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
826
- var myConnector = myConnectorName.split(".").reduce((function(a, v) {
820
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
827
821
  return a[v];
828
- }), this.properties);
822
+ }, this.properties);
829
823
  if (!myConnector) {
830
824
  error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
831
825
  }
@@ -842,7 +836,7 @@ function initJscadutils(_CSG, options = {}) {
842
836
  var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
843
837
  var union = scadApi__default["default"].booleanOps.union;
844
838
  init(CSG);
845
- var debug = Debug("jscadUtils:group");
839
+ var debug$3 = Debug("jscadUtils:group");
846
840
  function JsCadUtilsGroup() {
847
841
  var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
848
842
  var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -853,16 +847,16 @@ function initJscadutils(_CSG, options = {}) {
853
847
  this.holes = holes;
854
848
  }
855
849
  JsCadUtilsGroup.prototype.add = function(object, name, hidden, subparts, parts) {
856
- debug("add", object, name, hidden, subparts, parts);
850
+ debug$3("add", object, name, hidden, subparts, parts);
857
851
  var self = this;
858
852
  if (object.parts) {
859
853
  if (name) {
860
854
  if (!hidden) self.names.push(name);
861
855
  self.parts[name] = object.combine(parts);
862
856
  if (subparts) {
863
- Object.keys(object.parts).forEach((function(key) {
857
+ Object.keys(object.parts).forEach(function(key) {
864
858
  self.parts[subparts + key] = object.parts[key];
865
- }));
859
+ });
866
860
  }
867
861
  } else {
868
862
  Object.assign(self.parts, object.parts);
@@ -888,29 +882,30 @@ function initJscadutils(_CSG, options = {}) {
888
882
  if (pieces.length === 0) {
889
883
  throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
890
884
  }
891
- debug("combine", self.names, self.parts);
892
- var g = union(mapPick(self.parts, pieces, (function(value, key, index, object) {
885
+ debug$3("combine", self.names, self.parts);
886
+ var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
887
+ debug$3("combine mapPick", value, key, object);
893
888
  return map ? map(value, key, index, object) : identity(value);
894
- }), self.name));
889
+ }, self.name));
895
890
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
896
891
  } catch (err) {
897
- debug("combine error", this, pieces, options, err);
892
+ debug$3("combine error", this, pieces, options, err);
898
893
  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");
899
894
  }
900
895
  };
901
896
  JsCadUtilsGroup.prototype.map = function(cb) {
902
897
  var self = this;
903
- self.parts = Object.keys(self.parts).filter((function(k) {
898
+ self.parts = Object.keys(self.parts).filter(function(k) {
904
899
  return k !== "holes";
905
- })).reduce((function(result, key) {
900
+ }).reduce(function(result, key) {
906
901
  result[key] = cb(self.parts[key], key);
907
902
  return result;
908
- }), {});
903
+ }, {});
909
904
  if (self.holes) {
910
905
  if (Array.isArray(self.holes)) {
911
- self.holes = self.holes.map((function(hole, idx) {
906
+ self.holes = self.holes.map(function(hole, idx) {
912
907
  return cb(hole, idx);
913
- }));
908
+ });
914
909
  } else {
915
910
  self.holes = cb(self.holes, "holes");
916
911
  }
@@ -918,7 +913,7 @@ function initJscadutils(_CSG, options = {}) {
918
913
  return self;
919
914
  };
920
915
  JsCadUtilsGroup.prototype.clone = function(name, map) {
921
- debug("clone", name, _typeof(name), map);
916
+ debug$3("clone", name, _typeof(name), map);
922
917
  var self = this;
923
918
  if (typeof name == "function") {
924
919
  map = name;
@@ -926,15 +921,15 @@ function initJscadutils(_CSG, options = {}) {
926
921
  }
927
922
  if (!map) map = identity;
928
923
  var group = Group(name);
929
- Object.keys(self.parts).forEach((function(key) {
924
+ Object.keys(self.parts).forEach(function(key) {
930
925
  var part = self.parts[key];
931
926
  var hidden = self.names.indexOf(key) == -1;
932
927
  group.add(map(clone(part)), key, hidden);
933
- }));
928
+ });
934
929
  if (self.holes) {
935
- group.holes = toArray(self.holes).map((function(part) {
930
+ group.holes = toArray(self.holes).map(function(part) {
936
931
  return map(CSG.fromPolygons(part.toPolygons()), "holes");
937
- }));
932
+ });
938
933
  }
939
934
  return group;
940
935
  };
@@ -951,9 +946,9 @@ function initJscadutils(_CSG, options = {}) {
951
946
  }
952
947
  var rotationCenter = solid.centroid();
953
948
  var rotationAxis = axes[axis];
954
- self.map((function(part) {
949
+ self.map(function(part) {
955
950
  return part.rotate(rotationCenter, rotationAxis, angle);
956
- }));
951
+ });
957
952
  return self;
958
953
  };
959
954
  JsCadUtilsGroup.prototype.combineAll = function(options, map) {
@@ -964,12 +959,12 @@ function initJscadutils(_CSG, options = {}) {
964
959
  try {
965
960
  var self = this;
966
961
  var t = calcSnap(self.combine(part), to, axis, orientation, delta);
967
- self.map((function(part) {
962
+ self.map(function(part) {
968
963
  return part.translate(t);
969
- }));
964
+ });
970
965
  return self;
971
966
  } catch (err) {
972
- debug("snap error", this, part, to, axis, delta, err);
967
+ debug$3("snap error", this, part, to, axis, delta, err);
973
968
  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");
974
969
  }
975
970
  };
@@ -979,12 +974,12 @@ function initJscadutils(_CSG, options = {}) {
979
974
  var t = calcCenterWith(self.combine(part, {
980
975
  noholes: true
981
976
  }), axis, to, delta);
982
- self.map((function(part) {
977
+ self.map(function(part) {
983
978
  return part.translate(t);
984
- }));
979
+ });
985
980
  return self;
986
981
  } catch (err) {
987
- debug("align error", this, part, to, axis, delta, err);
982
+ debug$3("align error", this, part, to, axis, delta, err);
988
983
  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");
989
984
  }
990
985
  };
@@ -1000,7 +995,7 @@ function initJscadutils(_CSG, options = {}) {
1000
995
  JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
1001
996
  var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1002
997
  var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1003
- debug("connectTo", {
998
+ debug$3("connectTo", {
1004
999
  partName,
1005
1000
  connectorName,
1006
1001
  to,
@@ -1009,38 +1004,38 @@ function initJscadutils(_CSG, options = {}) {
1009
1004
  normalrotation
1010
1005
  });
1011
1006
  var self = this;
1012
- var myConnector = connectorName.split(".").reduce((function(a, v) {
1007
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1013
1008
  return a[v];
1014
- }), self.parts[partName].properties);
1015
- debug("toConnector", to instanceof CSG.Connector);
1016
- var toConnector = toConnectorName.split(".").reduce((function(a, v) {
1009
+ }, self.parts[partName].properties);
1010
+ debug$3("toConnector", to instanceof CSG.Connector);
1011
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1017
1012
  return a[v];
1018
- }), to.properties);
1013
+ }, to.properties);
1019
1014
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
1020
- debug("connectTo", matrix);
1021
- self.map((function(part) {
1015
+ debug$3("connectTo", matrix);
1016
+ self.map(function(part) {
1022
1017
  return part.transform(matrix);
1023
- }));
1018
+ });
1024
1019
  return self;
1025
1020
  };
1026
1021
  JsCadUtilsGroup.prototype.midlineTo = function midlineTo(part, axis, to) {
1027
1022
  var self = this;
1028
1023
  var size = self.combine(part).size();
1029
- var t = axisApply(axis, (function(i, a) {
1024
+ var t = axisApply(axis, function(i, a) {
1030
1025
  return to - size[a] / 2;
1031
- }));
1032
- self.map((function(part) {
1026
+ });
1027
+ self.map(function(part) {
1033
1028
  return part.translate(t);
1034
- }));
1029
+ });
1035
1030
  return self;
1036
1031
  };
1037
1032
  JsCadUtilsGroup.prototype.translate = function translate(x, y, z) {
1038
1033
  var self = this;
1039
1034
  var t = Array.isArray(x) ? x : [ x, y, z ];
1040
- debug("translate", t);
1041
- self.map((function(part) {
1035
+ debug$3("translate", t);
1036
+ self.map(function(part) {
1042
1037
  return part.translate(t);
1043
- }));
1038
+ });
1044
1039
  return self;
1045
1040
  };
1046
1041
  JsCadUtilsGroup.prototype.pick = function(parts, map) {
@@ -1048,9 +1043,9 @@ function initJscadutils(_CSG, options = {}) {
1048
1043
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1049
1044
  if (!map) map = identity;
1050
1045
  var g = Group();
1051
- p.forEach((function(name) {
1046
+ p.forEach(function(name) {
1052
1047
  g.add(map(CSG.fromPolygons(self.parts[name].toPolygons()), name), name);
1053
- }));
1048
+ });
1054
1049
  return g;
1055
1050
  };
1056
1051
  JsCadUtilsGroup.prototype.array = function(parts, map) {
@@ -1059,32 +1054,32 @@ function initJscadutils(_CSG, options = {}) {
1059
1054
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1060
1055
  if (!map) map = identity;
1061
1056
  var a = [];
1062
- p.forEach((function(name) {
1057
+ p.forEach(function(name) {
1063
1058
  if (!self.parts[name]) {
1064
- debug("array error", _this, parts);
1059
+ debug$3("array error", _this, parts);
1065
1060
  throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
1066
1061
  }
1067
1062
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
1068
- }));
1063
+ });
1069
1064
  return a;
1070
1065
  };
1071
1066
  JsCadUtilsGroup.prototype.toArray = function(pieces) {
1072
1067
  var self = this;
1073
1068
  var piecesArray = pieces ? pieces.split(",") : self.names;
1074
- return piecesArray.map((function(piece) {
1069
+ return piecesArray.map(function(piece) {
1075
1070
  if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
1076
1071
  return self.parts[piece];
1077
- }));
1072
+ });
1078
1073
  };
1079
1074
  JsCadUtilsGroup.prototype.toString = function() {
1080
- 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}');
1075
+ 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}");
1081
1076
  };
1082
1077
  JsCadUtilsGroup.prototype.setName = function(name) {
1083
1078
  this.name = name;
1084
1079
  return this;
1085
1080
  };
1086
1081
  function Group(objectNames, addObjects) {
1087
- debug("Group", objectNames, addObjects);
1082
+ debug$3("Group", objectNames, addObjects);
1088
1083
  var self = {
1089
1084
  name: "",
1090
1085
  names: [],
@@ -1107,9 +1102,9 @@ function initJscadutils(_CSG, options = {}) {
1107
1102
  self.name = objectNames;
1108
1103
  } else {
1109
1104
  var objects = objectNames;
1110
- self.names = Object.keys(objects).filter((function(k) {
1105
+ self.names = Object.keys(objects).filter(function(k) {
1111
1106
  return k !== "holes";
1112
- }));
1107
+ });
1113
1108
  self.parts = Object.assign({}, objects);
1114
1109
  self.holes = objects.holes;
1115
1110
  }
@@ -1117,7 +1112,7 @@ function initJscadutils(_CSG, options = {}) {
1117
1112
  }
1118
1113
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
1119
1114
  }
1120
- var debug$1 = Debug("jscadUtils:util");
1115
+ var debug$2 = Debug("jscadUtils:util");
1121
1116
  var NOZZEL_SIZE = .4;
1122
1117
  var nearest = {
1123
1118
  under: function under(desired) {
@@ -1152,7 +1147,7 @@ function initJscadutils(_CSG, options = {}) {
1152
1147
  return ((n = +n) || 1 / n) < 0;
1153
1148
  }
1154
1149
  function print(msg, o) {
1155
- debug$1(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1150
+ debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1156
1151
  }
1157
1152
  function jscadToString(o) {
1158
1153
  if (_typeof(o) == "object") {
@@ -1188,21 +1183,21 @@ function initJscadutils(_CSG, options = {}) {
1188
1183
  function label(text, x, y, width, height) {
1189
1184
  var l = vector_text(x || 0, y || 0, text);
1190
1185
  var o = [];
1191
- l.forEach((function(pl) {
1186
+ l.forEach(function(pl) {
1192
1187
  o.push(rectangular_extrude(pl, {
1193
1188
  w: width || 2,
1194
1189
  h: height || 2
1195
1190
  }));
1196
- }));
1191
+ });
1197
1192
  return center(union(o));
1198
1193
  }
1199
1194
  function text(text) {
1200
1195
  var l = vector_char(0, 0, text);
1201
- var _char = l.segments.reduce((function(result, segment) {
1196
+ var _char = l.segments.reduce(function(result, segment) {
1202
1197
  var path = new CSG.Path2D(segment);
1203
1198
  var cag = path.expandToCAG(2);
1204
1199
  return result ? result.union(cag) : cag;
1205
- }), undefined);
1200
+ }, undefined);
1206
1201
  return _char;
1207
1202
  }
1208
1203
  function unitCube(length, radius) {
@@ -1213,7 +1208,7 @@ function initJscadutils(_CSG, options = {}) {
1213
1208
  });
1214
1209
  }
1215
1210
  function unitAxis(length, radius, centroid) {
1216
- debug$1("unitAxis", length, radius, centroid);
1211
+ debug$2("unitAxis", length, radius, centroid);
1217
1212
  centroid = centroid || [ 0, 0, 0 ];
1218
1213
  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) ]);
1219
1214
  unitaxis.properties.origin = new CSG.Connector([ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ]);
@@ -1235,38 +1230,38 @@ function initJscadutils(_CSG, options = {}) {
1235
1230
  return result;
1236
1231
  }
1237
1232
  function zipObject(names, values) {
1238
- return names.reduce((function(result, value, idx) {
1233
+ return names.reduce(function(result, value, idx) {
1239
1234
  result[value] = values[idx];
1240
1235
  return result;
1241
- }), {});
1236
+ }, {});
1242
1237
  }
1243
1238
  function map(o, f) {
1244
- return Object.keys(o).map((function(key) {
1239
+ return Object.keys(o).map(function(key) {
1245
1240
  return f(o[key], key, o);
1246
- }));
1241
+ });
1247
1242
  }
1248
1243
  function mapValues(o, f) {
1249
- return Object.keys(o).map((function(key) {
1244
+ return Object.keys(o).map(function(key) {
1250
1245
  return f(o[key], key);
1251
- }));
1246
+ });
1252
1247
  }
1253
1248
  function pick(o, names) {
1254
- return names.reduce((function(result, name) {
1249
+ return names.reduce(function(result, name) {
1255
1250
  result[name] = o[name];
1256
1251
  return result;
1257
- }), {});
1252
+ }, {});
1258
1253
  }
1259
1254
  function mapPick(o, names, f, options) {
1260
- return names.reduce((function(result, name, index) {
1255
+ return names.reduce(function(result, name, index) {
1261
1256
  if (!o[name]) {
1262
1257
  throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
1263
1258
  }
1264
1259
  result.push(f ? f(o[name], name, index, o) : o[name]);
1265
1260
  return result;
1266
- }), []);
1261
+ }, []);
1267
1262
  }
1268
1263
  function divA(a, f) {
1269
- return div(a, f);
1264
+ return div$1(a, f);
1270
1265
  }
1271
1266
  function divxyz(size, x, y, z) {
1272
1267
  return {
@@ -1275,7 +1270,7 @@ function initJscadutils(_CSG, options = {}) {
1275
1270
  z: size.z / z
1276
1271
  };
1277
1272
  }
1278
- function div$1(size, d) {
1273
+ function div(size, d) {
1279
1274
  return this.divxyz(size, d, d, d);
1280
1275
  }
1281
1276
  function mulxyz(size, x, y, z) {
@@ -1327,9 +1322,9 @@ function initJscadutils(_CSG, options = {}) {
1327
1322
  var objectSize = size(object);
1328
1323
  var objectCentroid = centroid(object, objectSize);
1329
1324
  var idx = 0;
1330
- var t = map(objectSize, (function(i) {
1325
+ var t = map(objectSize, function(i) {
1331
1326
  return scale(i, a[idx++]);
1332
- }));
1327
+ });
1333
1328
  var new_object = object.scale(t);
1334
1329
  var new_centroid = centroid(new_object);
1335
1330
  var delta = new_centroid.minus(objectCentroid).times(-1);
@@ -1353,10 +1348,10 @@ function initJscadutils(_CSG, options = {}) {
1353
1348
  }
1354
1349
  var s = [ scale(objectSize.x, x), scale(objectSize.y, y), scale(objectSize.z, z) ];
1355
1350
  var min$1 = min(s);
1356
- return centerWith(object.scale(s.map((function(d, i) {
1351
+ return centerWith(object.scale(s.map(function(d, i) {
1357
1352
  if (a[i] === 0) return 1;
1358
1353
  return keep_aspect_ratio ? min$1 : d;
1359
- }))), "xyz", object);
1354
+ })), "xyz", object);
1360
1355
  }
1361
1356
  function shift(object, x, y, z) {
1362
1357
  var hsize = this.div(this.size(object.getBounds()), 2);
@@ -1395,9 +1390,9 @@ function initJscadutils(_CSG, options = {}) {
1395
1390
  if (side[0] === -1) {
1396
1391
  w[-1] = toxyz(withobj.centroid());
1397
1392
  }
1398
- return this.axisApply(axes, (function(i, axis) {
1393
+ return this.axisApply(axes, function(i, axis) {
1399
1394
  return w[side[0]][axis] - m[side[1]][axis];
1400
- }));
1395
+ });
1401
1396
  }
1402
1397
  function calcSnap(moveobj, withobj, axes, orientation) {
1403
1398
  var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
@@ -1418,15 +1413,15 @@ function initJscadutils(_CSG, options = {}) {
1418
1413
  if (side[0] === -1) {
1419
1414
  w[-1] = withobj.centroid();
1420
1415
  }
1421
- var t = axisApply(axes, (function(i, axis) {
1416
+ var t = axisApply(axes, function(i, axis) {
1422
1417
  return w[side[0]][axis] - m[side[1]][axis];
1423
- }));
1424
- return delta ? axisApply(axes, (function(i) {
1418
+ });
1419
+ return delta ? axisApply(axes, function(i) {
1425
1420
  return t[i] + delta;
1426
- })) : t;
1421
+ }) : t;
1427
1422
  }
1428
1423
  function snap(moveobj, withobj, axis, orientation, delta) {
1429
- debug$1("snap", moveobj, withobj, axis, orientation, delta);
1424
+ debug$2("snap", moveobj, withobj, axis, orientation, delta);
1430
1425
  var t = calcSnap(moveobj, withobj, axis, orientation, delta);
1431
1426
  return moveobj.translate(t);
1432
1427
  }
@@ -1434,16 +1429,16 @@ function initJscadutils(_CSG, options = {}) {
1434
1429
  return moveobj.translate(calcFlush(moveobj, withobj, axis, mside, wside));
1435
1430
  }
1436
1431
  function axisApply(axes, valfun, a) {
1437
- debug$1("axisApply", axes, valfun, a);
1432
+ debug$2("axisApply", axes, valfun, a);
1438
1433
  var retval = a || [ 0, 0, 0 ];
1439
1434
  var lookup = {
1440
1435
  x: 0,
1441
1436
  y: 1,
1442
1437
  z: 2
1443
1438
  };
1444
- axes.split("").forEach((function(axis) {
1439
+ axes.split("").forEach(function(axis) {
1445
1440
  retval[lookup[axis]] = valfun(lookup[axis], axis);
1446
- }));
1441
+ });
1447
1442
  return retval;
1448
1443
  }
1449
1444
  function axis2array(axes, valfun) {
@@ -1454,10 +1449,10 @@ function initJscadutils(_CSG, options = {}) {
1454
1449
  y: 1,
1455
1450
  z: 2
1456
1451
  };
1457
- axes.split("").forEach((function(axis) {
1452
+ axes.split("").forEach(function(axis) {
1458
1453
  var i = lookup[axis];
1459
1454
  a[i] = valfun(i, axis);
1460
- }));
1455
+ });
1461
1456
  return a;
1462
1457
  }
1463
1458
  function centroid(o, objectSize) {
@@ -1472,9 +1467,9 @@ function initJscadutils(_CSG, options = {}) {
1472
1467
  function calcmidlineTo(o, axis, to) {
1473
1468
  var bounds = o.getBounds();
1474
1469
  var objectSize = size(bounds);
1475
- return axisApply(axis, (function(i, a) {
1470
+ return axisApply(axis, function(i, a) {
1476
1471
  return to - objectSize[a] / 2;
1477
- }));
1472
+ });
1478
1473
  }
1479
1474
  function midlineTo(o, axis, to) {
1480
1475
  return o.translate(calcmidlineTo(o, axis, to));
@@ -1482,18 +1477,18 @@ function initJscadutils(_CSG, options = {}) {
1482
1477
  function translator(o, axis, withObj) {
1483
1478
  var objectCentroid = centroid(o);
1484
1479
  var withCentroid = centroid(withObj);
1485
- var t = axisApply(axis, (function(i) {
1480
+ var t = axisApply(axis, function(i) {
1486
1481
  return withCentroid[i] - objectCentroid[i];
1487
- }));
1482
+ });
1488
1483
  return t;
1489
1484
  }
1490
1485
  function calcCenterWith(o, axes, withObj) {
1491
1486
  var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1492
1487
  var objectCentroid = centroid(o);
1493
1488
  var withCentroid = centroid(withObj);
1494
- var t = axisApply(axes, (function(i, axis) {
1489
+ var t = axisApply(axes, function(i, axis) {
1495
1490
  return withCentroid[axis] - objectCentroid[axis];
1496
- }));
1491
+ });
1497
1492
  return delta ? add(t, delta) : t;
1498
1493
  }
1499
1494
  function centerWith(o, axis, withObj) {
@@ -1506,9 +1501,9 @@ function initJscadutils(_CSG, options = {}) {
1506
1501
  }
1507
1502
  }
1508
1503
  var dist = isNegative(offset) ? offset = size[axis] + offset : offset;
1509
- return axisApply(axis, (function(i, a) {
1504
+ return axisApply(axis, function(i, a) {
1510
1505
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1511
- }));
1506
+ });
1512
1507
  }
1513
1508
  function bisect() {
1514
1509
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -1571,14 +1566,14 @@ function initJscadutils(_CSG, options = {}) {
1571
1566
  }[[ axis, rotateaxis ].sort().join("")];
1572
1567
  var centroid = object.centroid();
1573
1568
  var rotateDelta = getDelta(objectSize, bounds, rotateOffsetAxis, rotateoffset);
1574
- var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", (function(i, a) {
1569
+ var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", function(i, a) {
1575
1570
  if (a == axis) return cutDelta[i];
1576
1571
  if (a == rotateOffsetAxis) return rotateDelta[i];
1577
1572
  return centroid[a];
1578
- })));
1573
+ }));
1579
1574
  var theRotationAxis = rotationAxes[rotateaxis];
1580
1575
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(info.orthoNormalCartesian[0], info.orthoNormalCartesian[1]).translate(cutDelta).rotate(rotationCenter, theRotationAxis, angle);
1581
- debug$1("bisect", debug$1.enabled && {
1576
+ debug$2("bisect", debug$2.enabled && {
1582
1577
  axis,
1583
1578
  offset,
1584
1579
  angle,
@@ -1659,21 +1654,18 @@ function initJscadutils(_CSG, options = {}) {
1659
1654
  return CSG.fromPolygons(polygons);
1660
1655
  }
1661
1656
  function slices2poly(slices, options, axis) {
1662
- debug$1("slices2poly", slices, options, axis);
1657
+ debug$2("slices2poly", slices, options, axis);
1663
1658
  options = Object.assign({
1664
1659
  twistangle: 0,
1665
1660
  twiststeps: 0
1666
1661
  }, options);
1667
1662
  var twistangle = options && parseFloat(options.twistangle) || 0;
1668
- var twiststeps = options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1669
- if (twistangle == 0 || twiststeps < 1) {
1670
- twiststeps = 1;
1671
- }
1663
+ options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1672
1664
  var normalVector = options.si.normalVector;
1673
1665
  var polygons = [];
1674
1666
  var first$1 = first(slices);
1675
1667
  var last$1 = last(slices);
1676
- debug$1("slices2poly first", first$1, first$1.offset, "last", last$1);
1668
+ debug$2("slices2poly first", first$1, first$1.offset, "last", last$1);
1677
1669
  var up = first$1.offset[axis] > last$1.offset[axis];
1678
1670
  polygons = polygons.concat(first$1.poly._toPlanePolygons({
1679
1671
  translation: first$1.offset,
@@ -1692,7 +1684,7 @@ function initJscadutils(_CSG, options = {}) {
1692
1684
  return v[rotateAxis](angle * percent);
1693
1685
  };
1694
1686
  var connectorAxis = last$1.offset.minus(first$1.offset).abs();
1695
- slices.forEach((function(slice, idx) {
1687
+ slices.forEach(function(slice, idx) {
1696
1688
  if (idx < slices.length - 1) {
1697
1689
  var nextidx = idx + 1;
1698
1690
  var top = !up ? slices[nextidx] : slice;
@@ -1705,7 +1697,7 @@ function initJscadutils(_CSG, options = {}) {
1705
1697
  toConnector2: c2
1706
1698
  }));
1707
1699
  }
1708
- }));
1700
+ });
1709
1701
  return CSG.fromPolygons(polygons);
1710
1702
  }
1711
1703
  function normalVector(axis) {
@@ -1746,12 +1738,12 @@ function initJscadutils(_CSG, options = {}) {
1746
1738
  var info = dirInfo["dir" + direction];
1747
1739
  return Object.assign({
1748
1740
  axis,
1749
- cutDelta: axisApply(axis, (function(i, a) {
1741
+ cutDelta: axisApply(axis, function(i, a) {
1750
1742
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.sizeDir;
1751
- })),
1752
- moveDelta: axisApply(axis, (function(i, a) {
1743
+ }),
1744
+ moveDelta: axisApply(axis, function(i, a) {
1753
1745
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.moveDir;
1754
- }))
1746
+ })
1755
1747
  }, info, normalVector(axis));
1756
1748
  }
1757
1749
  function reShape(object, radius, orientation, options, slicer) {
@@ -1759,18 +1751,18 @@ function initJscadutils(_CSG, options = {}) {
1759
1751
  var b = object.getBounds();
1760
1752
  var absoluteRadius = Math.abs(radius);
1761
1753
  var si = sliceParams(orientation, radius, b);
1762
- debug$1("reShape", absoluteRadius, si);
1754
+ debug$2("reShape", absoluteRadius, si);
1763
1755
  if (si.axis !== "z") throw new Error('reShape error: CAG._toPlanePolytons only uses the "z" axis. You must use the "z" axis for now.');
1764
1756
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(si.orthoNormalCartesian[0], si.orthoNormalCartesian[1]).translate(si.cutDelta);
1765
1757
  var slice = object.sectionCut(cutplane);
1766
- var first = axisApply(si.axis, (function() {
1758
+ var first = axisApply(si.axis, function() {
1767
1759
  return si.positive ? 0 : absoluteRadius;
1768
- }));
1769
- var last = axisApply(si.axis, (function() {
1760
+ });
1761
+ var last = axisApply(si.axis, function() {
1770
1762
  return si.positive ? absoluteRadius : 0;
1771
- }));
1763
+ });
1772
1764
  var plane = si.positive ? cutplane.plane : cutplane.plane.flipped();
1773
- debug$1("reShape first/last", first, last);
1765
+ debug$2("reShape first/last", first, last);
1774
1766
  var slices = slicer(first, last, slice, radius);
1775
1767
  var delta = slices2poly(slices, Object.assign(options, {
1776
1768
  si
@@ -1779,7 +1771,7 @@ function initJscadutils(_CSG, options = {}) {
1779
1771
  return union([ options.unionOriginal ? object : remainder, delta.translate(si.moveDelta) ]);
1780
1772
  }
1781
1773
  function chamfer(object, radius, orientation, options) {
1782
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1774
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1783
1775
  return [ {
1784
1776
  poly: slice,
1785
1777
  offset: new CSG.Vector3D(first)
@@ -1787,15 +1779,15 @@ function initJscadutils(_CSG, options = {}) {
1787
1779
  poly: enlarge(slice, [ -radius * 2, -radius * 2 ]),
1788
1780
  offset: new CSG.Vector3D(last)
1789
1781
  } ];
1790
- }));
1782
+ });
1791
1783
  }
1792
1784
  function fillet(object, radius, orientation, options) {
1793
1785
  options = options || {};
1794
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1786
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1795
1787
  var v1 = new CSG.Vector3D(first);
1796
1788
  var v2 = new CSG.Vector3D(last);
1797
1789
  var res = options.resolution || CSG.defaultResolution3D;
1798
- var slices = range(0, res).map((function(i) {
1790
+ var slices = range(0, res).map(function(i) {
1799
1791
  var p = i > 0 ? i / (res - 1) : 0;
1800
1792
  var v = v1.lerp(v2, p);
1801
1793
  var size = -radius * 2 - Math.cos(Math.asin(p)) * (-radius * 2);
@@ -1803,9 +1795,9 @@ function initJscadutils(_CSG, options = {}) {
1803
1795
  poly: enlarge(slice, [ size, size ]),
1804
1796
  offset: v
1805
1797
  };
1806
- }));
1798
+ });
1807
1799
  return slices;
1808
- }));
1800
+ });
1809
1801
  }
1810
1802
  function calcRotate(part, solid, axis) {
1811
1803
  var axes = {
@@ -1825,16 +1817,16 @@ function initJscadutils(_CSG, options = {}) {
1825
1817
  return part.rotate(rotationCenter, rotationAxis, angle);
1826
1818
  }
1827
1819
  function cloneProperties(from, to) {
1828
- return Object.entries(from).reduce((function(props, _ref) {
1820
+ return Object.entries(from).reduce(function(props, _ref) {
1829
1821
  var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1830
1822
  props[key] = value;
1831
1823
  return props;
1832
- }), to);
1824
+ }, to);
1833
1825
  }
1834
1826
  function clone(o) {
1835
1827
  var c = CSG.fromPolygons(o.toPolygons());
1836
1828
  cloneProperties(o, c);
1837
- debug$1("clone", o, c, CSG);
1829
+ debug$2("clone", o, c, CSG);
1838
1830
  return c;
1839
1831
  }
1840
1832
  function addConnector(object, name) {
@@ -1844,15 +1836,15 @@ function initJscadutils(_CSG, options = {}) {
1844
1836
  object.properties[name] = new CSG.Connector(point, axis, normal);
1845
1837
  return object;
1846
1838
  }
1847
- var debug$2 = Debug("jscadUtils:parts");
1839
+ var debug$1 = Debug("jscadUtils:parts");
1848
1840
  var parts = {
1849
- BBox,
1841
+ BBox: BBox$1,
1850
1842
  Cube,
1851
1843
  RoundedCube,
1852
1844
  Cylinder,
1853
1845
  Cone
1854
1846
  };
1855
- function BBox() {
1847
+ function BBox$1() {
1856
1848
  function box(object) {
1857
1849
  return CSG.cube({
1858
1850
  center: object.centroid(),
@@ -1862,13 +1854,13 @@ function initJscadutils(_CSG, options = {}) {
1862
1854
  for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1863
1855
  objects[_key] = arguments[_key];
1864
1856
  }
1865
- return objects.reduce((function(bbox, part) {
1857
+ return objects.reduce(function(bbox, part) {
1866
1858
  var object = bbox ? union([ bbox, box(part) ]) : part;
1867
1859
  return box(object);
1868
- }), undefined);
1860
+ }, undefined);
1869
1861
  }
1870
1862
  function Cube(width) {
1871
- var r = div(fromxyz(width), 2);
1863
+ var r = div$1(fromxyz(width), 2);
1872
1864
  return CSG.cube({
1873
1865
  center: r,
1874
1866
  radius: r
@@ -1883,7 +1875,7 @@ function initJscadutils(_CSG, options = {}) {
1883
1875
  } else {
1884
1876
  var r = [ x / 2, y / 2 ];
1885
1877
  }
1886
- debug$2("RoundedCube", size$1, r, thickness, corner_radius);
1878
+ debug$1("RoundedCube", size$1, r, thickness, corner_radius);
1887
1879
  var roundedcube = CAG.roundedRectangle({
1888
1880
  center: [ r[0], r[1], 0 ],
1889
1881
  radius: r,
@@ -1896,7 +1888,7 @@ function initJscadutils(_CSG, options = {}) {
1896
1888
  }
1897
1889
  function Cylinder(diameter, height) {
1898
1890
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1899
- debug$2("parts.Cylinder", diameter, height, options);
1891
+ debug$1("parts.Cylinder", diameter, height, options);
1900
1892
  options = Object.assign({
1901
1893
  start: [ 0, 0, 0 ],
1902
1894
  end: [ 0, 0, height ],
@@ -1907,7 +1899,7 @@ function initJscadutils(_CSG, options = {}) {
1907
1899
  }
1908
1900
  function Cone(diameter1, diameter2, height) {
1909
1901
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1910
- debug$2("parts.Cone", diameter1, diameter2, height, options);
1902
+ debug$1("parts.Cone", diameter1, diameter2, height, options);
1911
1903
  return CSG.cylinder(Object.assign({
1912
1904
  start: [ 0, 0, 0 ],
1913
1905
  end: [ 0, 0, height ],
@@ -1917,7 +1909,7 @@ function initJscadutils(_CSG, options = {}) {
1917
1909
  }, options));
1918
1910
  }
1919
1911
  function Hexagon(diameter, height) {
1920
- debug$2("hexagon", diameter, height);
1912
+ debug$1("hexagon", diameter, height);
1921
1913
  var radius = diameter / 2;
1922
1914
  var sqrt3 = Math.sqrt(3) / 2;
1923
1915
  var hex = CAG.fromPoints([ [ radius, 0 ], [ radius / 2, radius * sqrt3 ], [ -radius / 2, radius * sqrt3 ], [ -radius, 0 ], [ -radius / 2, -radius * sqrt3 ], [ radius / 2, -radius * sqrt3 ] ]);
@@ -2015,7 +2007,7 @@ function initJscadutils(_CSG, options = {}) {
2015
2007
  var parts$1 = Object.freeze({
2016
2008
  __proto__: null,
2017
2009
  default: parts,
2018
- BBox,
2010
+ BBox: BBox$1,
2019
2011
  Cube,
2020
2012
  RoundedCube,
2021
2013
  Cylinder,
@@ -2027,13 +2019,13 @@ function initJscadutils(_CSG, options = {}) {
2027
2019
  Board,
2028
2020
  Hardware
2029
2021
  });
2030
- var debug$3 = Debug("jscadUtils:boxes");
2022
+ var debug = Debug("jscadUtils:boxes");
2031
2023
  function RabbetJoin(box, thickness, cutHeight) {
2032
2024
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
2033
2025
  return rabbetJoin(box, thickness, cutHeight);
2034
2026
  }
2035
2027
  function topMiddleBottom(box, thickness) {
2036
- debug$3("TopMiddleBottom", box, thickness);
2028
+ debug("TopMiddleBottom", box, thickness);
2037
2029
  var bottom = box.bisect("z", thickness, {
2038
2030
  color: true
2039
2031
  });
@@ -2042,11 +2034,11 @@ function initJscadutils(_CSG, options = {}) {
2042
2034
  }
2043
2035
  function Rabett(box, thickness, gap, height, face) {
2044
2036
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2045
- debug$3("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2037
+ debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2046
2038
  gap = gap || .25;
2047
2039
  var inside = thickness - gap;
2048
2040
  var outside = -thickness + gap;
2049
- debug$3("inside", inside, "outside", outside);
2041
+ debug("inside", inside, "outside", outside);
2050
2042
  var group = Group();
2051
2043
  var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
2052
2044
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
@@ -2068,7 +2060,7 @@ function initJscadutils(_CSG, options = {}) {
2068
2060
  topWidth: -thickness,
2069
2061
  bottomWidth: thickness
2070
2062
  }, options);
2071
- debug$3("RabettTopBottom", box, thickness, gap, options);
2063
+ debug("RabettTopBottom", box, thickness, gap, options);
2072
2064
  var group = Group("", {
2073
2065
  box
2074
2066
  });
@@ -2114,7 +2106,7 @@ function initJscadutils(_CSG, options = {}) {
2114
2106
  };
2115
2107
  var Rectangle = function Rectangle(size, thickness, cb) {
2116
2108
  thickness = thickness || 2;
2117
- var s = div(xyz2array(size), 2);
2109
+ var s = div$1(xyz2array(size), 2);
2118
2110
  var r = add(s, thickness);
2119
2111
  var box = CSG.cube({
2120
2112
  center: r,
@@ -2134,16 +2126,16 @@ function initJscadutils(_CSG, options = {}) {
2134
2126
  if (exteriorcb) box = exteriorcb(box);
2135
2127
  return box;
2136
2128
  };
2137
- var BBox$1 = function BBox(o) {
2129
+ var BBox = function BBox(o) {
2138
2130
  depreciated("BBox", true, "Use 'parts.BBox' instead");
2139
- var s = div(xyz2array(o.size()), 2);
2131
+ var s = div$1(xyz2array(o.size()), 2);
2140
2132
  return CSG.cube({
2141
2133
  center: s,
2142
2134
  radius: s
2143
2135
  }).align(o, "xyz");
2144
2136
  };
2145
2137
  function getRadius(o) {
2146
- return div(xyz2array(o.size()), 2);
2138
+ return div$1(xyz2array(o.size()), 2);
2147
2139
  }
2148
2140
  function rabbetJoin(box, thickness) {
2149
2141
  var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
@@ -2171,7 +2163,7 @@ function initJscadutils(_CSG, options = {}) {
2171
2163
  CutOut,
2172
2164
  Rectangle,
2173
2165
  Hollow,
2174
- BBox: BBox$1
2166
+ BBox
2175
2167
  });
2176
2168
  var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
2177
2169
  group: Group,
@@ -2191,6 +2183,9 @@ function initJscadutils(_CSG, options = {}) {
2191
2183
  exports.parts = parts$1;
2192
2184
  exports.triUtils = triUtils;
2193
2185
  exports.util = util;
2186
+ Object.defineProperty(exports, "__esModule", {
2187
+ value: true
2188
+ });
2194
2189
  return exports;
2195
2190
  }({}, jsCadCSG, scadApi);
2196
2191
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");