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