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