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