@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.
@@ -160,7 +160,7 @@ function initJscadutils(_CSG, options = {}) {
160
160
  return divxyz;
161
161
  },
162
162
  get div() {
163
- return div$1;
163
+ return div;
164
164
  },
165
165
  get mulxyz() {
166
166
  return mulxyz;
@@ -292,104 +292,98 @@ function initJscadutils(_CSG, options = {}) {
292
292
  return addConnector;
293
293
  }
294
294
  });
295
- function _typeof(obj) {
296
- "@babel/helpers - typeof";
297
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
298
- _typeof = function(obj) {
299
- return typeof obj;
300
- };
301
- } else {
302
- _typeof = function(obj) {
303
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
304
- };
305
- }
306
- return _typeof(obj);
307
- }
308
- function _defineProperty(obj, key, value) {
309
- if (key in obj) {
310
- Object.defineProperty(obj, key, {
311
- value,
312
- enumerable: true,
313
- configurable: true,
314
- writable: true
315
- });
316
- } else {
317
- obj[key] = value;
318
- }
319
- return obj;
320
- }
321
- function ownKeys(object, enumerableOnly) {
322
- var keys = Object.keys(object);
323
- if (Object.getOwnPropertySymbols) {
324
- var symbols = Object.getOwnPropertySymbols(object);
325
- if (enumerableOnly) symbols = symbols.filter((function(sym) {
326
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
327
- }));
328
- keys.push.apply(keys, symbols);
329
- }
330
- return keys;
331
- }
332
- function _objectSpread2(target) {
333
- for (var i = 1; i < arguments.length; i++) {
334
- var source = arguments[i] != null ? arguments[i] : {};
335
- if (i % 2) {
336
- ownKeys(Object(source), true).forEach((function(key) {
337
- _defineProperty(target, key, source[key]);
338
- }));
339
- } else if (Object.getOwnPropertyDescriptors) {
340
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
341
- } else {
342
- ownKeys(Object(source)).forEach((function(key) {
343
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
344
- }));
295
+ function _arrayLikeToArray(r, a) {
296
+ (null == a || a > r.length) && (a = r.length);
297
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
298
+ return n;
299
+ }
300
+ function _arrayWithHoles(r) {
301
+ if (Array.isArray(r)) return r;
302
+ }
303
+ function _defineProperty(e, r, t) {
304
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
305
+ value: t,
306
+ enumerable: !0,
307
+ configurable: !0,
308
+ writable: !0
309
+ }) : e[r] = t, e;
310
+ }
311
+ function _iterableToArrayLimit(r, l) {
312
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
313
+ if (null != t) {
314
+ var e, n, i, u, a = [], f = !0, o = !1;
315
+ try {
316
+ if (i = (t = t.call(r)).next, 0 === l) {
317
+ if (Object(t) !== t) return;
318
+ f = !1;
319
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
320
+ } catch (r) {
321
+ o = !0, n = r;
322
+ } finally {
323
+ try {
324
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
325
+ } finally {
326
+ if (o) throw n;
327
+ }
345
328
  }
329
+ return a;
346
330
  }
347
- return target;
348
331
  }
349
- function _slicedToArray(arr, i) {
350
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
351
- }
352
- function _arrayWithHoles(arr) {
353
- if (Array.isArray(arr)) return arr;
332
+ function _nonIterableRest() {
333
+ 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
334
  }
355
- function _iterableToArrayLimit(arr, i) {
356
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
357
- var _arr = [];
358
- var _n = true;
359
- var _d = false;
360
- var _e = undefined;
361
- try {
362
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
363
- _arr.push(_s.value);
364
- if (i && _arr.length === i) break;
365
- }
366
- } catch (err) {
367
- _d = true;
368
- _e = err;
369
- } finally {
370
- try {
371
- if (!_n && _i["return"] != null) _i["return"]();
372
- } finally {
373
- if (_d) throw _e;
374
- }
335
+ function ownKeys(e, r) {
336
+ var t = Object.keys(e);
337
+ if (Object.getOwnPropertySymbols) {
338
+ var o = Object.getOwnPropertySymbols(e);
339
+ r && (o = o.filter(function(r) {
340
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
341
+ })), t.push.apply(t, o);
375
342
  }
376
- return _arr;
343
+ return t;
377
344
  }
378
- function _unsupportedIterableToArray(o, minLen) {
379
- if (!o) return;
380
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
381
- var n = Object.prototype.toString.call(o).slice(8, -1);
382
- if (n === "Object" && o.constructor) n = o.constructor.name;
383
- if (n === "Map" || n === "Set") return Array.from(o);
384
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
345
+ function _objectSpread2(e) {
346
+ for (var r = 1; r < arguments.length; r++) {
347
+ var t = null != arguments[r] ? arguments[r] : {};
348
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
349
+ _defineProperty(e, r, t[r]);
350
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
351
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
352
+ });
353
+ }
354
+ return e;
355
+ }
356
+ function _slicedToArray(r, e) {
357
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
358
+ }
359
+ function _toPrimitive(t, r) {
360
+ if ("object" != typeof t || !t) return t;
361
+ var e = t[Symbol.toPrimitive];
362
+ if (void 0 !== e) {
363
+ var i = e.call(t, r || "default");
364
+ if ("object" != typeof i) return i;
365
+ throw new TypeError("@@toPrimitive must return a primitive value.");
366
+ }
367
+ return ("string" === r ? String : Number)(t);
385
368
  }
386
- function _arrayLikeToArray(arr, len) {
387
- if (len == null || len > arr.length) len = arr.length;
388
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
389
- return arr2;
369
+ function _toPropertyKey(t) {
370
+ var i = _toPrimitive(t, "string");
371
+ return "symbol" == typeof i ? i : i + "";
390
372
  }
391
- function _nonIterableRest() {
392
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
373
+ function _typeof(o) {
374
+ "@babel/helpers - typeof";
375
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
376
+ return typeof o;
377
+ } : function(o) {
378
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
379
+ }, _typeof(o);
380
+ }
381
+ function _unsupportedIterableToArray(r, a) {
382
+ if (r) {
383
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
384
+ var t = {}.toString.call(r).slice(8, -1);
385
+ 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;
386
+ }
393
387
  }
394
388
  var toRadians = function toRadians(deg) {
395
389
  return deg / 180 * Math.PI;
@@ -449,30 +443,30 @@ function initJscadutils(_CSG, options = {}) {
449
443
  solve90ac,
450
444
  solveab
451
445
  });
452
- var div = function div(a, f) {
453
- return a.map((function(e) {
446
+ var div$1 = function div(a, f) {
447
+ return a.map(function(e) {
454
448
  return e / f;
455
- }));
449
+ });
456
450
  };
457
451
  var addValue = function addValue(a, f) {
458
- return a.map((function(e) {
452
+ return a.map(function(e) {
459
453
  return e + f;
460
- }));
454
+ });
461
455
  };
462
456
  var addArray = function addArray(a, f) {
463
- return a.map((function(e, i) {
457
+ return a.map(function(e, i) {
464
458
  return e + f[i];
465
- }));
459
+ });
466
460
  };
467
461
  var add = function add(a) {
468
- return Array.prototype.slice.call(arguments, 1).reduce((function(result, arg) {
462
+ return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
469
463
  if (Array.isArray(arg)) {
470
464
  result = addArray(result, arg);
471
465
  } else {
472
466
  result = addValue(result, arg);
473
467
  }
474
468
  return result;
475
- }), a);
469
+ }, a);
476
470
  };
477
471
  var fromxyz = function fromxyz(object) {
478
472
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
@@ -491,9 +485,9 @@ function initJscadutils(_CSG, options = {}) {
491
485
  return a && a.length > 0 ? a[a.length - 1] : undefined;
492
486
  };
493
487
  var min = function min(a) {
494
- return a.reduce((function(result, value) {
488
+ return a.reduce(function(result, value) {
495
489
  return value < result ? value : result;
496
- }), Number.MAX_VALUE);
490
+ }, Number.MAX_VALUE);
497
491
  };
498
492
  var range = function range(a, b) {
499
493
  var result = [];
@@ -504,7 +498,7 @@ function initJscadutils(_CSG, options = {}) {
504
498
  };
505
499
  var array = Object.freeze({
506
500
  __proto__: null,
507
- div,
501
+ div: div$1,
508
502
  addValue,
509
503
  addArray,
510
504
  add,
@@ -527,11 +521,11 @@ function initJscadutils(_CSG, options = {}) {
527
521
  }
528
522
  }, jscadUtilsDebug || {});
529
523
  var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
530
- var enabled = checks.enabled.some((function checkEnabled(check) {
524
+ var enabled = checks.enabled.some(function checkEnabled(check) {
531
525
  return check.test(name);
532
- })) && !checks.disabled.some((function checkEnabled(check) {
526
+ }) && !checks.disabled.some(function checkEnabled(check) {
533
527
  return check.test(name);
534
- }));
528
+ });
535
529
  var logger = enabled ? checks.options.browser ? function() {
536
530
  var _console;
537
531
  for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -718,9 +712,9 @@ function initJscadutils(_CSG, options = {}) {
718
712
  function color(o, r, g, b, a) {
719
713
  if (typeof r !== "string") return o.setColor(r, g, b, a);
720
714
  if (r === "") return o;
721
- var c = name2rgb(r).map((function(x) {
715
+ var c = name2rgb(r).map(function(x) {
722
716
  return x / 255;
723
- }));
717
+ });
724
718
  c[3] = g || 1;
725
719
  return o.setColor(c);
726
720
  }
@@ -822,10 +816,10 @@ function initJscadutils(_CSG, options = {}) {
822
816
  if (arguments.length === 1) {
823
817
  return this._translate(arguments[0]);
824
818
  } else {
825
- var t = Array.prototype.slice.call(arguments, 0).reduce((function(result, arg) {
819
+ var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
826
820
  result = undefined(result, arg);
827
821
  return result;
828
- }), [ 0, 0, 0 ]);
822
+ }, [ 0, 0, 0 ]);
829
823
  return this._translate(t);
830
824
  }
831
825
  };
@@ -835,9 +829,9 @@ function initJscadutils(_CSG, options = {}) {
835
829
  proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
836
830
  var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
837
831
  var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
838
- var myConnector = myConnectorName.split(".").reduce((function(a, v) {
832
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
839
833
  return a[v];
840
- }), this.properties);
834
+ }, this.properties);
841
835
  if (!myConnector) {
842
836
  error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
843
837
  }
@@ -854,7 +848,7 @@ function initJscadutils(_CSG, options = {}) {
854
848
  var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
855
849
  var union = scadApi__default["default"].booleanOps.union;
856
850
  init(CSG);
857
- var debug = Debug("jscadUtils:group");
851
+ var debug$3 = Debug("jscadUtils:group");
858
852
  function JsCadUtilsGroup() {
859
853
  var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
860
854
  var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -865,16 +859,16 @@ function initJscadutils(_CSG, options = {}) {
865
859
  this.holes = holes;
866
860
  }
867
861
  JsCadUtilsGroup.prototype.add = function(object, name, hidden, subparts, parts) {
868
- debug("add", object, name, hidden, subparts, parts);
862
+ debug$3("add", object, name, hidden, subparts, parts);
869
863
  var self = this;
870
864
  if (object.parts) {
871
865
  if (name) {
872
866
  if (!hidden) self.names.push(name);
873
867
  self.parts[name] = object.combine(parts);
874
868
  if (subparts) {
875
- Object.keys(object.parts).forEach((function(key) {
869
+ Object.keys(object.parts).forEach(function(key) {
876
870
  self.parts[subparts + key] = object.parts[key];
877
- }));
871
+ });
878
872
  }
879
873
  } else {
880
874
  Object.assign(self.parts, object.parts);
@@ -900,29 +894,30 @@ function initJscadutils(_CSG, options = {}) {
900
894
  if (pieces.length === 0) {
901
895
  throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
902
896
  }
903
- debug("combine", self.names, self.parts);
904
- var g = union(mapPick(self.parts, pieces, (function(value, key, index, object) {
897
+ debug$3("combine", self.names, self.parts);
898
+ var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
899
+ debug$3("combine mapPick", value, key, object);
905
900
  return map ? map(value, key, index, object) : identity(value);
906
- }), self.name));
901
+ }, self.name));
907
902
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
908
903
  } catch (err) {
909
- debug("combine error", this, pieces, options, err);
904
+ debug$3("combine error", this, pieces, options, err);
910
905
  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");
911
906
  }
912
907
  };
913
908
  JsCadUtilsGroup.prototype.map = function(cb) {
914
909
  var self = this;
915
- self.parts = Object.keys(self.parts).filter((function(k) {
910
+ self.parts = Object.keys(self.parts).filter(function(k) {
916
911
  return k !== "holes";
917
- })).reduce((function(result, key) {
912
+ }).reduce(function(result, key) {
918
913
  result[key] = cb(self.parts[key], key);
919
914
  return result;
920
- }), {});
915
+ }, {});
921
916
  if (self.holes) {
922
917
  if (Array.isArray(self.holes)) {
923
- self.holes = self.holes.map((function(hole, idx) {
918
+ self.holes = self.holes.map(function(hole, idx) {
924
919
  return cb(hole, idx);
925
- }));
920
+ });
926
921
  } else {
927
922
  self.holes = cb(self.holes, "holes");
928
923
  }
@@ -930,7 +925,7 @@ function initJscadutils(_CSG, options = {}) {
930
925
  return self;
931
926
  };
932
927
  JsCadUtilsGroup.prototype.clone = function(name, map) {
933
- debug("clone", name, _typeof(name), map);
928
+ debug$3("clone", name, _typeof(name), map);
934
929
  var self = this;
935
930
  if (typeof name == "function") {
936
931
  map = name;
@@ -938,15 +933,15 @@ function initJscadutils(_CSG, options = {}) {
938
933
  }
939
934
  if (!map) map = identity;
940
935
  var group = Group(name);
941
- Object.keys(self.parts).forEach((function(key) {
936
+ Object.keys(self.parts).forEach(function(key) {
942
937
  var part = self.parts[key];
943
938
  var hidden = self.names.indexOf(key) == -1;
944
939
  group.add(map(clone(part)), key, hidden);
945
- }));
940
+ });
946
941
  if (self.holes) {
947
- group.holes = toArray(self.holes).map((function(part) {
942
+ group.holes = toArray(self.holes).map(function(part) {
948
943
  return map(CSG.fromPolygons(part.toPolygons()), "holes");
949
- }));
944
+ });
950
945
  }
951
946
  return group;
952
947
  };
@@ -963,9 +958,9 @@ function initJscadutils(_CSG, options = {}) {
963
958
  }
964
959
  var rotationCenter = solid.centroid();
965
960
  var rotationAxis = axes[axis];
966
- self.map((function(part) {
961
+ self.map(function(part) {
967
962
  return part.rotate(rotationCenter, rotationAxis, angle);
968
- }));
963
+ });
969
964
  return self;
970
965
  };
971
966
  JsCadUtilsGroup.prototype.combineAll = function(options, map) {
@@ -976,12 +971,12 @@ function initJscadutils(_CSG, options = {}) {
976
971
  try {
977
972
  var self = this;
978
973
  var t = calcSnap(self.combine(part), to, axis, orientation, 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("snap error", this, part, to, axis, delta, err);
979
+ debug$3("snap error", this, part, to, axis, delta, err);
985
980
  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");
986
981
  }
987
982
  };
@@ -991,12 +986,12 @@ function initJscadutils(_CSG, options = {}) {
991
986
  var t = calcCenterWith(self.combine(part, {
992
987
  noholes: true
993
988
  }), axis, to, delta);
994
- self.map((function(part) {
989
+ self.map(function(part) {
995
990
  return part.translate(t);
996
- }));
991
+ });
997
992
  return self;
998
993
  } catch (err) {
999
- debug("align error", this, part, to, axis, delta, err);
994
+ debug$3("align error", this, part, to, axis, delta, err);
1000
995
  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");
1001
996
  }
1002
997
  };
@@ -1012,7 +1007,7 @@ function initJscadutils(_CSG, options = {}) {
1012
1007
  JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
1013
1008
  var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1014
1009
  var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1015
- debug("connectTo", {
1010
+ debug$3("connectTo", {
1016
1011
  partName,
1017
1012
  connectorName,
1018
1013
  to,
@@ -1021,38 +1016,38 @@ function initJscadutils(_CSG, options = {}) {
1021
1016
  normalrotation
1022
1017
  });
1023
1018
  var self = this;
1024
- var myConnector = connectorName.split(".").reduce((function(a, v) {
1019
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1025
1020
  return a[v];
1026
- }), self.parts[partName].properties);
1027
- debug("toConnector", to instanceof CSG.Connector);
1028
- var toConnector = toConnectorName.split(".").reduce((function(a, v) {
1021
+ }, self.parts[partName].properties);
1022
+ debug$3("toConnector", to instanceof CSG.Connector);
1023
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1029
1024
  return a[v];
1030
- }), to.properties);
1025
+ }, to.properties);
1031
1026
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
1032
- debug("connectTo", matrix);
1033
- self.map((function(part) {
1027
+ debug$3("connectTo", matrix);
1028
+ self.map(function(part) {
1034
1029
  return part.transform(matrix);
1035
- }));
1030
+ });
1036
1031
  return self;
1037
1032
  };
1038
1033
  JsCadUtilsGroup.prototype.midlineTo = function midlineTo(part, axis, to) {
1039
1034
  var self = this;
1040
1035
  var size = self.combine(part).size();
1041
- var t = axisApply(axis, (function(i, a) {
1036
+ var t = axisApply(axis, function(i, a) {
1042
1037
  return to - size[a] / 2;
1043
- }));
1044
- self.map((function(part) {
1038
+ });
1039
+ self.map(function(part) {
1045
1040
  return part.translate(t);
1046
- }));
1041
+ });
1047
1042
  return self;
1048
1043
  };
1049
1044
  JsCadUtilsGroup.prototype.translate = function translate(x, y, z) {
1050
1045
  var self = this;
1051
1046
  var t = Array.isArray(x) ? x : [ x, y, z ];
1052
- debug("translate", t);
1053
- self.map((function(part) {
1047
+ debug$3("translate", t);
1048
+ self.map(function(part) {
1054
1049
  return part.translate(t);
1055
- }));
1050
+ });
1056
1051
  return self;
1057
1052
  };
1058
1053
  JsCadUtilsGroup.prototype.pick = function(parts, map) {
@@ -1060,9 +1055,9 @@ function initJscadutils(_CSG, options = {}) {
1060
1055
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1061
1056
  if (!map) map = identity;
1062
1057
  var g = Group();
1063
- p.forEach((function(name) {
1058
+ p.forEach(function(name) {
1064
1059
  g.add(map(CSG.fromPolygons(self.parts[name].toPolygons()), name), name);
1065
- }));
1060
+ });
1066
1061
  return g;
1067
1062
  };
1068
1063
  JsCadUtilsGroup.prototype.array = function(parts, map) {
@@ -1071,32 +1066,32 @@ function initJscadutils(_CSG, options = {}) {
1071
1066
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
1072
1067
  if (!map) map = identity;
1073
1068
  var a = [];
1074
- p.forEach((function(name) {
1069
+ p.forEach(function(name) {
1075
1070
  if (!self.parts[name]) {
1076
- debug("array error", _this, parts);
1071
+ debug$3("array error", _this, parts);
1077
1072
  throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
1078
1073
  }
1079
1074
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
1080
- }));
1075
+ });
1081
1076
  return a;
1082
1077
  };
1083
1078
  JsCadUtilsGroup.prototype.toArray = function(pieces) {
1084
1079
  var self = this;
1085
1080
  var piecesArray = pieces ? pieces.split(",") : self.names;
1086
- return piecesArray.map((function(piece) {
1081
+ return piecesArray.map(function(piece) {
1087
1082
  if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
1088
1083
  return self.parts[piece];
1089
- }));
1084
+ });
1090
1085
  };
1091
1086
  JsCadUtilsGroup.prototype.toString = function() {
1092
- 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}');
1087
+ 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}");
1093
1088
  };
1094
1089
  JsCadUtilsGroup.prototype.setName = function(name) {
1095
1090
  this.name = name;
1096
1091
  return this;
1097
1092
  };
1098
1093
  function Group(objectNames, addObjects) {
1099
- debug("Group", objectNames, addObjects);
1094
+ debug$3("Group", objectNames, addObjects);
1100
1095
  var self = {
1101
1096
  name: "",
1102
1097
  names: [],
@@ -1119,9 +1114,9 @@ function initJscadutils(_CSG, options = {}) {
1119
1114
  self.name = objectNames;
1120
1115
  } else {
1121
1116
  var objects = objectNames;
1122
- self.names = Object.keys(objects).filter((function(k) {
1117
+ self.names = Object.keys(objects).filter(function(k) {
1123
1118
  return k !== "holes";
1124
- }));
1119
+ });
1125
1120
  self.parts = Object.assign({}, objects);
1126
1121
  self.holes = objects.holes;
1127
1122
  }
@@ -1129,7 +1124,7 @@ function initJscadutils(_CSG, options = {}) {
1129
1124
  }
1130
1125
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
1131
1126
  }
1132
- var debug$1 = Debug("jscadUtils:util");
1127
+ var debug$2 = Debug("jscadUtils:util");
1133
1128
  var NOZZEL_SIZE = .4;
1134
1129
  var nearest = {
1135
1130
  under: function under(desired) {
@@ -1164,7 +1159,7 @@ function initJscadutils(_CSG, options = {}) {
1164
1159
  return ((n = +n) || 1 / n) < 0;
1165
1160
  }
1166
1161
  function print(msg, o) {
1167
- debug$1(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1162
+ debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
1168
1163
  }
1169
1164
  function jscadToString(o) {
1170
1165
  if (_typeof(o) == "object") {
@@ -1200,21 +1195,21 @@ function initJscadutils(_CSG, options = {}) {
1200
1195
  function label(text, x, y, width, height) {
1201
1196
  var l = vector_text(x || 0, y || 0, text);
1202
1197
  var o = [];
1203
- l.forEach((function(pl) {
1198
+ l.forEach(function(pl) {
1204
1199
  o.push(rectangular_extrude(pl, {
1205
1200
  w: width || 2,
1206
1201
  h: height || 2
1207
1202
  }));
1208
- }));
1203
+ });
1209
1204
  return center(union(o));
1210
1205
  }
1211
1206
  function text(text) {
1212
1207
  var l = vector_char(0, 0, text);
1213
- var _char = l.segments.reduce((function(result, segment) {
1208
+ var _char = l.segments.reduce(function(result, segment) {
1214
1209
  var path = new CSG.Path2D(segment);
1215
1210
  var cag = path.expandToCAG(2);
1216
1211
  return result ? result.union(cag) : cag;
1217
- }), undefined);
1212
+ }, undefined);
1218
1213
  return _char;
1219
1214
  }
1220
1215
  function unitCube(length, radius) {
@@ -1225,7 +1220,7 @@ function initJscadutils(_CSG, options = {}) {
1225
1220
  });
1226
1221
  }
1227
1222
  function unitAxis(length, radius, centroid) {
1228
- debug$1("unitAxis", length, radius, centroid);
1223
+ debug$2("unitAxis", length, radius, centroid);
1229
1224
  centroid = centroid || [ 0, 0, 0 ];
1230
1225
  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) ]);
1231
1226
  unitaxis.properties.origin = new CSG.Connector([ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ]);
@@ -1247,38 +1242,38 @@ function initJscadutils(_CSG, options = {}) {
1247
1242
  return result;
1248
1243
  }
1249
1244
  function zipObject(names, values) {
1250
- return names.reduce((function(result, value, idx) {
1245
+ return names.reduce(function(result, value, idx) {
1251
1246
  result[value] = values[idx];
1252
1247
  return result;
1253
- }), {});
1248
+ }, {});
1254
1249
  }
1255
1250
  function map(o, f) {
1256
- return Object.keys(o).map((function(key) {
1251
+ return Object.keys(o).map(function(key) {
1257
1252
  return f(o[key], key, o);
1258
- }));
1253
+ });
1259
1254
  }
1260
1255
  function mapValues(o, f) {
1261
- return Object.keys(o).map((function(key) {
1256
+ return Object.keys(o).map(function(key) {
1262
1257
  return f(o[key], key);
1263
- }));
1258
+ });
1264
1259
  }
1265
1260
  function pick(o, names) {
1266
- return names.reduce((function(result, name) {
1261
+ return names.reduce(function(result, name) {
1267
1262
  result[name] = o[name];
1268
1263
  return result;
1269
- }), {});
1264
+ }, {});
1270
1265
  }
1271
1266
  function mapPick(o, names, f, options) {
1272
- return names.reduce((function(result, name, index) {
1267
+ return names.reduce(function(result, name, index) {
1273
1268
  if (!o[name]) {
1274
1269
  throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
1275
1270
  }
1276
1271
  result.push(f ? f(o[name], name, index, o) : o[name]);
1277
1272
  return result;
1278
- }), []);
1273
+ }, []);
1279
1274
  }
1280
1275
  function divA(a, f) {
1281
- return div(a, f);
1276
+ return div$1(a, f);
1282
1277
  }
1283
1278
  function divxyz(size, x, y, z) {
1284
1279
  return {
@@ -1287,7 +1282,7 @@ function initJscadutils(_CSG, options = {}) {
1287
1282
  z: size.z / z
1288
1283
  };
1289
1284
  }
1290
- function div$1(size, d) {
1285
+ function div(size, d) {
1291
1286
  return this.divxyz(size, d, d, d);
1292
1287
  }
1293
1288
  function mulxyz(size, x, y, z) {
@@ -1339,9 +1334,9 @@ function initJscadutils(_CSG, options = {}) {
1339
1334
  var objectSize = size(object);
1340
1335
  var objectCentroid = centroid(object, objectSize);
1341
1336
  var idx = 0;
1342
- var t = map(objectSize, (function(i) {
1337
+ var t = map(objectSize, function(i) {
1343
1338
  return scale(i, a[idx++]);
1344
- }));
1339
+ });
1345
1340
  var new_object = object.scale(t);
1346
1341
  var new_centroid = centroid(new_object);
1347
1342
  var delta = new_centroid.minus(objectCentroid).times(-1);
@@ -1365,10 +1360,10 @@ function initJscadutils(_CSG, options = {}) {
1365
1360
  }
1366
1361
  var s = [ scale(objectSize.x, x), scale(objectSize.y, y), scale(objectSize.z, z) ];
1367
1362
  var min$1 = min(s);
1368
- return centerWith(object.scale(s.map((function(d, i) {
1363
+ return centerWith(object.scale(s.map(function(d, i) {
1369
1364
  if (a[i] === 0) return 1;
1370
1365
  return keep_aspect_ratio ? min$1 : d;
1371
- }))), "xyz", object);
1366
+ })), "xyz", object);
1372
1367
  }
1373
1368
  function shift(object, x, y, z) {
1374
1369
  var hsize = this.div(this.size(object.getBounds()), 2);
@@ -1407,9 +1402,9 @@ function initJscadutils(_CSG, options = {}) {
1407
1402
  if (side[0] === -1) {
1408
1403
  w[-1] = toxyz(withobj.centroid());
1409
1404
  }
1410
- return this.axisApply(axes, (function(i, axis) {
1405
+ return this.axisApply(axes, function(i, axis) {
1411
1406
  return w[side[0]][axis] - m[side[1]][axis];
1412
- }));
1407
+ });
1413
1408
  }
1414
1409
  function calcSnap(moveobj, withobj, axes, orientation) {
1415
1410
  var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
@@ -1430,15 +1425,15 @@ function initJscadutils(_CSG, options = {}) {
1430
1425
  if (side[0] === -1) {
1431
1426
  w[-1] = withobj.centroid();
1432
1427
  }
1433
- var t = axisApply(axes, (function(i, axis) {
1428
+ var t = axisApply(axes, function(i, axis) {
1434
1429
  return w[side[0]][axis] - m[side[1]][axis];
1435
- }));
1436
- return delta ? axisApply(axes, (function(i) {
1430
+ });
1431
+ return delta ? axisApply(axes, function(i) {
1437
1432
  return t[i] + delta;
1438
- })) : t;
1433
+ }) : t;
1439
1434
  }
1440
1435
  function snap(moveobj, withobj, axis, orientation, delta) {
1441
- debug$1("snap", moveobj, withobj, axis, orientation, delta);
1436
+ debug$2("snap", moveobj, withobj, axis, orientation, delta);
1442
1437
  var t = calcSnap(moveobj, withobj, axis, orientation, delta);
1443
1438
  return moveobj.translate(t);
1444
1439
  }
@@ -1446,16 +1441,16 @@ function initJscadutils(_CSG, options = {}) {
1446
1441
  return moveobj.translate(calcFlush(moveobj, withobj, axis, mside, wside));
1447
1442
  }
1448
1443
  function axisApply(axes, valfun, a) {
1449
- debug$1("axisApply", axes, valfun, a);
1444
+ debug$2("axisApply", axes, valfun, a);
1450
1445
  var retval = a || [ 0, 0, 0 ];
1451
1446
  var lookup = {
1452
1447
  x: 0,
1453
1448
  y: 1,
1454
1449
  z: 2
1455
1450
  };
1456
- axes.split("").forEach((function(axis) {
1451
+ axes.split("").forEach(function(axis) {
1457
1452
  retval[lookup[axis]] = valfun(lookup[axis], axis);
1458
- }));
1453
+ });
1459
1454
  return retval;
1460
1455
  }
1461
1456
  function axis2array(axes, valfun) {
@@ -1466,10 +1461,10 @@ function initJscadutils(_CSG, options = {}) {
1466
1461
  y: 1,
1467
1462
  z: 2
1468
1463
  };
1469
- axes.split("").forEach((function(axis) {
1464
+ axes.split("").forEach(function(axis) {
1470
1465
  var i = lookup[axis];
1471
1466
  a[i] = valfun(i, axis);
1472
- }));
1467
+ });
1473
1468
  return a;
1474
1469
  }
1475
1470
  function centroid(o, objectSize) {
@@ -1484,9 +1479,9 @@ function initJscadutils(_CSG, options = {}) {
1484
1479
  function calcmidlineTo(o, axis, to) {
1485
1480
  var bounds = o.getBounds();
1486
1481
  var objectSize = size(bounds);
1487
- return axisApply(axis, (function(i, a) {
1482
+ return axisApply(axis, function(i, a) {
1488
1483
  return to - objectSize[a] / 2;
1489
- }));
1484
+ });
1490
1485
  }
1491
1486
  function midlineTo(o, axis, to) {
1492
1487
  return o.translate(calcmidlineTo(o, axis, to));
@@ -1494,18 +1489,18 @@ function initJscadutils(_CSG, options = {}) {
1494
1489
  function translator(o, axis, withObj) {
1495
1490
  var objectCentroid = centroid(o);
1496
1491
  var withCentroid = centroid(withObj);
1497
- var t = axisApply(axis, (function(i) {
1492
+ var t = axisApply(axis, function(i) {
1498
1493
  return withCentroid[i] - objectCentroid[i];
1499
- }));
1494
+ });
1500
1495
  return t;
1501
1496
  }
1502
1497
  function calcCenterWith(o, axes, withObj) {
1503
1498
  var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1504
1499
  var objectCentroid = centroid(o);
1505
1500
  var withCentroid = centroid(withObj);
1506
- var t = axisApply(axes, (function(i, axis) {
1501
+ var t = axisApply(axes, function(i, axis) {
1507
1502
  return withCentroid[axis] - objectCentroid[axis];
1508
- }));
1503
+ });
1509
1504
  return delta ? add(t, delta) : t;
1510
1505
  }
1511
1506
  function centerWith(o, axis, withObj) {
@@ -1518,9 +1513,9 @@ function initJscadutils(_CSG, options = {}) {
1518
1513
  }
1519
1514
  }
1520
1515
  var dist = isNegative(offset) ? offset = size[axis] + offset : offset;
1521
- return axisApply(axis, (function(i, a) {
1516
+ return axisApply(axis, function(i, a) {
1522
1517
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1523
- }));
1518
+ });
1524
1519
  }
1525
1520
  function bisect() {
1526
1521
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -1583,14 +1578,14 @@ function initJscadutils(_CSG, options = {}) {
1583
1578
  }[[ axis, rotateaxis ].sort().join("")];
1584
1579
  var centroid = object.centroid();
1585
1580
  var rotateDelta = getDelta(objectSize, bounds, rotateOffsetAxis, rotateoffset);
1586
- var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", (function(i, a) {
1581
+ var rotationCenter = options.rotationCenter || new CSG.Vector3D(axisApply("xyz", function(i, a) {
1587
1582
  if (a == axis) return cutDelta[i];
1588
1583
  if (a == rotateOffsetAxis) return rotateDelta[i];
1589
1584
  return centroid[a];
1590
- })));
1585
+ }));
1591
1586
  var theRotationAxis = rotationAxes[rotateaxis];
1592
1587
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(info.orthoNormalCartesian[0], info.orthoNormalCartesian[1]).translate(cutDelta).rotate(rotationCenter, theRotationAxis, angle);
1593
- debug$1("bisect", debug$1.enabled && {
1588
+ debug$2("bisect", debug$2.enabled && {
1594
1589
  axis,
1595
1590
  offset,
1596
1591
  angle,
@@ -1671,21 +1666,18 @@ function initJscadutils(_CSG, options = {}) {
1671
1666
  return CSG.fromPolygons(polygons);
1672
1667
  }
1673
1668
  function slices2poly(slices, options, axis) {
1674
- debug$1("slices2poly", slices, options, axis);
1669
+ debug$2("slices2poly", slices, options, axis);
1675
1670
  options = Object.assign({
1676
1671
  twistangle: 0,
1677
1672
  twiststeps: 0
1678
1673
  }, options);
1679
1674
  var twistangle = options && parseFloat(options.twistangle) || 0;
1680
- var twiststeps = options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1681
- if (twistangle == 0 || twiststeps < 1) {
1682
- twiststeps = 1;
1683
- }
1675
+ options && parseInt(options.twiststeps) || CSG.defaultResolution3D;
1684
1676
  var normalVector = options.si.normalVector;
1685
1677
  var polygons = [];
1686
1678
  var first$1 = first(slices);
1687
1679
  var last$1 = last(slices);
1688
- debug$1("slices2poly first", first$1, first$1.offset, "last", last$1);
1680
+ debug$2("slices2poly first", first$1, first$1.offset, "last", last$1);
1689
1681
  var up = first$1.offset[axis] > last$1.offset[axis];
1690
1682
  polygons = polygons.concat(first$1.poly._toPlanePolygons({
1691
1683
  translation: first$1.offset,
@@ -1704,7 +1696,7 @@ function initJscadutils(_CSG, options = {}) {
1704
1696
  return v[rotateAxis](angle * percent);
1705
1697
  };
1706
1698
  var connectorAxis = last$1.offset.minus(first$1.offset).abs();
1707
- slices.forEach((function(slice, idx) {
1699
+ slices.forEach(function(slice, idx) {
1708
1700
  if (idx < slices.length - 1) {
1709
1701
  var nextidx = idx + 1;
1710
1702
  var top = !up ? slices[nextidx] : slice;
@@ -1717,7 +1709,7 @@ function initJscadutils(_CSG, options = {}) {
1717
1709
  toConnector2: c2
1718
1710
  }));
1719
1711
  }
1720
- }));
1712
+ });
1721
1713
  return CSG.fromPolygons(polygons);
1722
1714
  }
1723
1715
  function normalVector(axis) {
@@ -1758,12 +1750,12 @@ function initJscadutils(_CSG, options = {}) {
1758
1750
  var info = dirInfo["dir" + direction];
1759
1751
  return Object.assign({
1760
1752
  axis,
1761
- cutDelta: axisApply(axis, (function(i, a) {
1753
+ cutDelta: axisApply(axis, function(i, a) {
1762
1754
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.sizeDir;
1763
- })),
1764
- moveDelta: axisApply(axis, (function(i, a) {
1755
+ }),
1756
+ moveDelta: axisApply(axis, function(i, a) {
1765
1757
  return bounds[info.sizeIdx][a] + Math.abs(radius) * info.moveDir;
1766
- }))
1758
+ })
1767
1759
  }, info, normalVector(axis));
1768
1760
  }
1769
1761
  function reShape(object, radius, orientation, options, slicer) {
@@ -1771,18 +1763,18 @@ function initJscadutils(_CSG, options = {}) {
1771
1763
  var b = object.getBounds();
1772
1764
  var absoluteRadius = Math.abs(radius);
1773
1765
  var si = sliceParams(orientation, radius, b);
1774
- debug$1("reShape", absoluteRadius, si);
1766
+ debug$2("reShape", absoluteRadius, si);
1775
1767
  if (si.axis !== "z") throw new Error('reShape error: CAG._toPlanePolytons only uses the "z" axis. You must use the "z" axis for now.');
1776
1768
  var cutplane = CSG.OrthoNormalBasis.GetCartesian(si.orthoNormalCartesian[0], si.orthoNormalCartesian[1]).translate(si.cutDelta);
1777
1769
  var slice = object.sectionCut(cutplane);
1778
- var first = axisApply(si.axis, (function() {
1770
+ var first = axisApply(si.axis, function() {
1779
1771
  return si.positive ? 0 : absoluteRadius;
1780
- }));
1781
- var last = axisApply(si.axis, (function() {
1772
+ });
1773
+ var last = axisApply(si.axis, function() {
1782
1774
  return si.positive ? absoluteRadius : 0;
1783
- }));
1775
+ });
1784
1776
  var plane = si.positive ? cutplane.plane : cutplane.plane.flipped();
1785
- debug$1("reShape first/last", first, last);
1777
+ debug$2("reShape first/last", first, last);
1786
1778
  var slices = slicer(first, last, slice, radius);
1787
1779
  var delta = slices2poly(slices, Object.assign(options, {
1788
1780
  si
@@ -1791,7 +1783,7 @@ function initJscadutils(_CSG, options = {}) {
1791
1783
  return union([ options.unionOriginal ? object : remainder, delta.translate(si.moveDelta) ]);
1792
1784
  }
1793
1785
  function chamfer(object, radius, orientation, options) {
1794
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1786
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1795
1787
  return [ {
1796
1788
  poly: slice,
1797
1789
  offset: new CSG.Vector3D(first)
@@ -1799,15 +1791,15 @@ function initJscadutils(_CSG, options = {}) {
1799
1791
  poly: enlarge(slice, [ -radius * 2, -radius * 2 ]),
1800
1792
  offset: new CSG.Vector3D(last)
1801
1793
  } ];
1802
- }));
1794
+ });
1803
1795
  }
1804
1796
  function fillet(object, radius, orientation, options) {
1805
1797
  options = options || {};
1806
- return reShape(object, radius, orientation, options, (function(first, last, slice) {
1798
+ return reShape(object, radius, orientation, options, function(first, last, slice) {
1807
1799
  var v1 = new CSG.Vector3D(first);
1808
1800
  var v2 = new CSG.Vector3D(last);
1809
1801
  var res = options.resolution || CSG.defaultResolution3D;
1810
- var slices = range(0, res).map((function(i) {
1802
+ var slices = range(0, res).map(function(i) {
1811
1803
  var p = i > 0 ? i / (res - 1) : 0;
1812
1804
  var v = v1.lerp(v2, p);
1813
1805
  var size = -radius * 2 - Math.cos(Math.asin(p)) * (-radius * 2);
@@ -1815,9 +1807,9 @@ function initJscadutils(_CSG, options = {}) {
1815
1807
  poly: enlarge(slice, [ size, size ]),
1816
1808
  offset: v
1817
1809
  };
1818
- }));
1810
+ });
1819
1811
  return slices;
1820
- }));
1812
+ });
1821
1813
  }
1822
1814
  function calcRotate(part, solid, axis) {
1823
1815
  var axes = {
@@ -1837,16 +1829,16 @@ function initJscadutils(_CSG, options = {}) {
1837
1829
  return part.rotate(rotationCenter, rotationAxis, angle);
1838
1830
  }
1839
1831
  function cloneProperties(from, to) {
1840
- return Object.entries(from).reduce((function(props, _ref) {
1832
+ return Object.entries(from).reduce(function(props, _ref) {
1841
1833
  var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1842
1834
  props[key] = value;
1843
1835
  return props;
1844
- }), to);
1836
+ }, to);
1845
1837
  }
1846
1838
  function clone(o) {
1847
1839
  var c = CSG.fromPolygons(o.toPolygons());
1848
1840
  cloneProperties(o, c);
1849
- debug$1("clone", o, c, CSG);
1841
+ debug$2("clone", o, c, CSG);
1850
1842
  return c;
1851
1843
  }
1852
1844
  function addConnector(object, name) {
@@ -1856,15 +1848,15 @@ function initJscadutils(_CSG, options = {}) {
1856
1848
  object.properties[name] = new CSG.Connector(point, axis, normal);
1857
1849
  return object;
1858
1850
  }
1859
- var debug$2 = Debug("jscadUtils:parts");
1851
+ var debug$1 = Debug("jscadUtils:parts");
1860
1852
  var parts = {
1861
- BBox,
1853
+ BBox: BBox$1,
1862
1854
  Cube,
1863
1855
  RoundedCube,
1864
1856
  Cylinder,
1865
1857
  Cone
1866
1858
  };
1867
- function BBox() {
1859
+ function BBox$1() {
1868
1860
  function box(object) {
1869
1861
  return CSG.cube({
1870
1862
  center: object.centroid(),
@@ -1874,13 +1866,13 @@ function initJscadutils(_CSG, options = {}) {
1874
1866
  for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1875
1867
  objects[_key] = arguments[_key];
1876
1868
  }
1877
- return objects.reduce((function(bbox, part) {
1869
+ return objects.reduce(function(bbox, part) {
1878
1870
  var object = bbox ? union([ bbox, box(part) ]) : part;
1879
1871
  return box(object);
1880
- }), undefined);
1872
+ }, undefined);
1881
1873
  }
1882
1874
  function Cube(width) {
1883
- var r = div(fromxyz(width), 2);
1875
+ var r = div$1(fromxyz(width), 2);
1884
1876
  return CSG.cube({
1885
1877
  center: r,
1886
1878
  radius: r
@@ -1895,7 +1887,7 @@ function initJscadutils(_CSG, options = {}) {
1895
1887
  } else {
1896
1888
  var r = [ x / 2, y / 2 ];
1897
1889
  }
1898
- debug$2("RoundedCube", size$1, r, thickness, corner_radius);
1890
+ debug$1("RoundedCube", size$1, r, thickness, corner_radius);
1899
1891
  var roundedcube = CAG.roundedRectangle({
1900
1892
  center: [ r[0], r[1], 0 ],
1901
1893
  radius: r,
@@ -1908,7 +1900,7 @@ function initJscadutils(_CSG, options = {}) {
1908
1900
  }
1909
1901
  function Cylinder(diameter, height) {
1910
1902
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1911
- debug$2("parts.Cylinder", diameter, height, options);
1903
+ debug$1("parts.Cylinder", diameter, height, options);
1912
1904
  options = Object.assign({
1913
1905
  start: [ 0, 0, 0 ],
1914
1906
  end: [ 0, 0, height ],
@@ -1919,7 +1911,7 @@ function initJscadutils(_CSG, options = {}) {
1919
1911
  }
1920
1912
  function Cone(diameter1, diameter2, height) {
1921
1913
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1922
- debug$2("parts.Cone", diameter1, diameter2, height, options);
1914
+ debug$1("parts.Cone", diameter1, diameter2, height, options);
1923
1915
  return CSG.cylinder(Object.assign({
1924
1916
  start: [ 0, 0, 0 ],
1925
1917
  end: [ 0, 0, height ],
@@ -1929,7 +1921,7 @@ function initJscadutils(_CSG, options = {}) {
1929
1921
  }, options));
1930
1922
  }
1931
1923
  function Hexagon(diameter, height) {
1932
- debug$2("hexagon", diameter, height);
1924
+ debug$1("hexagon", diameter, height);
1933
1925
  var radius = diameter / 2;
1934
1926
  var sqrt3 = Math.sqrt(3) / 2;
1935
1927
  var hex = CAG.fromPoints([ [ radius, 0 ], [ radius / 2, radius * sqrt3 ], [ -radius / 2, radius * sqrt3 ], [ -radius, 0 ], [ -radius / 2, -radius * sqrt3 ], [ radius / 2, -radius * sqrt3 ] ]);
@@ -2027,7 +2019,7 @@ function initJscadutils(_CSG, options = {}) {
2027
2019
  var parts$1 = Object.freeze({
2028
2020
  __proto__: null,
2029
2021
  default: parts,
2030
- BBox,
2022
+ BBox: BBox$1,
2031
2023
  Cube,
2032
2024
  RoundedCube,
2033
2025
  Cylinder,
@@ -2039,13 +2031,13 @@ function initJscadutils(_CSG, options = {}) {
2039
2031
  Board,
2040
2032
  Hardware
2041
2033
  });
2042
- var debug$3 = Debug("jscadUtils:boxes");
2034
+ var debug = Debug("jscadUtils:boxes");
2043
2035
  function RabbetJoin(box, thickness, cutHeight) {
2044
2036
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
2045
2037
  return rabbetJoin(box, thickness, cutHeight);
2046
2038
  }
2047
2039
  function topMiddleBottom(box, thickness) {
2048
- debug$3("TopMiddleBottom", box, thickness);
2040
+ debug("TopMiddleBottom", box, thickness);
2049
2041
  var bottom = box.bisect("z", thickness, {
2050
2042
  color: true
2051
2043
  });
@@ -2054,11 +2046,11 @@ function initJscadutils(_CSG, options = {}) {
2054
2046
  }
2055
2047
  function Rabett(box, thickness, gap, height, face) {
2056
2048
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2057
- debug$3("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2049
+ debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
2058
2050
  gap = gap || .25;
2059
2051
  var inside = thickness - gap;
2060
2052
  var outside = -thickness + gap;
2061
- debug$3("inside", inside, "outside", outside);
2053
+ debug("inside", inside, "outside", outside);
2062
2054
  var group = Group();
2063
2055
  var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
2064
2056
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
@@ -2080,7 +2072,7 @@ function initJscadutils(_CSG, options = {}) {
2080
2072
  topWidth: -thickness,
2081
2073
  bottomWidth: thickness
2082
2074
  }, options);
2083
- debug$3("RabettTopBottom", box, thickness, gap, options);
2075
+ debug("RabettTopBottom", box, thickness, gap, options);
2084
2076
  var group = Group("", {
2085
2077
  box
2086
2078
  });
@@ -2126,7 +2118,7 @@ function initJscadutils(_CSG, options = {}) {
2126
2118
  };
2127
2119
  var Rectangle = function Rectangle(size, thickness, cb) {
2128
2120
  thickness = thickness || 2;
2129
- var s = div(xyz2array(size), 2);
2121
+ var s = div$1(xyz2array(size), 2);
2130
2122
  var r = add(s, thickness);
2131
2123
  var box = CSG.cube({
2132
2124
  center: r,
@@ -2146,16 +2138,16 @@ function initJscadutils(_CSG, options = {}) {
2146
2138
  if (exteriorcb) box = exteriorcb(box);
2147
2139
  return box;
2148
2140
  };
2149
- var BBox$1 = function BBox(o) {
2141
+ var BBox = function BBox(o) {
2150
2142
  depreciated("BBox", true, "Use 'parts.BBox' instead");
2151
- var s = div(xyz2array(o.size()), 2);
2143
+ var s = div$1(xyz2array(o.size()), 2);
2152
2144
  return CSG.cube({
2153
2145
  center: s,
2154
2146
  radius: s
2155
2147
  }).align(o, "xyz");
2156
2148
  };
2157
2149
  function getRadius(o) {
2158
- return div(xyz2array(o.size()), 2);
2150
+ return div$1(xyz2array(o.size()), 2);
2159
2151
  }
2160
2152
  function rabbetJoin(box, thickness) {
2161
2153
  var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
@@ -2183,7 +2175,7 @@ function initJscadutils(_CSG, options = {}) {
2183
2175
  CutOut,
2184
2176
  Rectangle,
2185
2177
  Hollow,
2186
- BBox: BBox$1
2178
+ BBox
2187
2179
  });
2188
2180
  var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
2189
2181
  group: Group,
@@ -2203,6 +2195,9 @@ function initJscadutils(_CSG, options = {}) {
2203
2195
  exports.parts = parts$1;
2204
2196
  exports.triUtils = triUtils;
2205
2197
  exports.util = util;
2198
+ Object.defineProperty(exports, "__esModule", {
2199
+ value: true
2200
+ });
2206
2201
  return exports;
2207
2202
  }({}, jsCadCSG, scadApi);
2208
2203
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");