@jwc/jscad-utils 5.0.1 → 5.1.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.
@@ -54,13 +54,329 @@ function initJscadutils(_CSG, options = {}) {
54
54
  });
55
55
  var jscadUtils = function(exports, jsCadCSG, scadApi) {
56
56
  "use strict";
57
- const toRadians = function toRadians(deg) {
57
+ function _interopDefaultLegacy(e) {
58
+ return e && typeof e === "object" && "default" in e ? e : {
59
+ default: e
60
+ };
61
+ }
62
+ var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
63
+ var scadApi__default = _interopDefaultLegacy(scadApi);
64
+ var util = Object.freeze({
65
+ __proto__: null,
66
+ get NOZZEL_SIZE() {
67
+ return NOZZEL_SIZE;
68
+ },
69
+ get nearest() {
70
+ return nearest;
71
+ },
72
+ get identity() {
73
+ return identity;
74
+ },
75
+ get result() {
76
+ return result;
77
+ },
78
+ get defaults() {
79
+ return defaults;
80
+ },
81
+ get isEmpty() {
82
+ return isEmpty;
83
+ },
84
+ get isNegative() {
85
+ return isNegative;
86
+ },
87
+ get print() {
88
+ return print;
89
+ },
90
+ get jscadToString() {
91
+ return jscadToString;
92
+ },
93
+ get error() {
94
+ return error;
95
+ },
96
+ get depreciated() {
97
+ return depreciated;
98
+ },
99
+ get inch() {
100
+ return inch;
101
+ },
102
+ get cm() {
103
+ return cm;
104
+ },
105
+ get label() {
106
+ return label;
107
+ },
108
+ get text() {
109
+ return text;
110
+ },
111
+ get unitCube() {
112
+ return unitCube;
113
+ },
114
+ get unitAxis() {
115
+ return unitAxis;
116
+ },
117
+ get toArray() {
118
+ return toArray;
119
+ },
120
+ get ifArray() {
121
+ return ifArray;
122
+ },
123
+ get segment() {
124
+ return segment;
125
+ },
126
+ get zipObject() {
127
+ return zipObject;
128
+ },
129
+ get map() {
130
+ return map;
131
+ },
132
+ get mapValues() {
133
+ return mapValues;
134
+ },
135
+ get pick() {
136
+ return pick;
137
+ },
138
+ get mapPick() {
139
+ return mapPick;
140
+ },
141
+ get divA() {
142
+ return divA;
143
+ },
144
+ get divxyz() {
145
+ return divxyz;
146
+ },
147
+ get div() {
148
+ return div;
149
+ },
150
+ get mulxyz() {
151
+ return mulxyz;
152
+ },
153
+ get mul() {
154
+ return mul;
155
+ },
156
+ get xyz2array() {
157
+ return xyz2array;
158
+ },
159
+ get rotationAxes() {
160
+ return rotationAxes;
161
+ },
162
+ get size() {
163
+ return size;
164
+ },
165
+ get scale() {
166
+ return scale;
167
+ },
168
+ get center() {
169
+ return center;
170
+ },
171
+ get centerY() {
172
+ return centerY;
173
+ },
174
+ get centerX() {
175
+ return centerX;
176
+ },
177
+ get enlarge() {
178
+ return enlarge;
179
+ },
180
+ get fit() {
181
+ return fit;
182
+ },
183
+ get shift() {
184
+ return shift;
185
+ },
186
+ get zero() {
187
+ return zero;
188
+ },
189
+ get mirrored4() {
190
+ return mirrored4;
191
+ },
192
+ get flushSide() {
193
+ return flushSide;
194
+ },
195
+ get calcFlush() {
196
+ return calcFlush;
197
+ },
198
+ get calcSnap() {
199
+ return calcSnap;
200
+ },
201
+ get snap() {
202
+ return snap;
203
+ },
204
+ get flush() {
205
+ return flush;
206
+ },
207
+ get axisApply() {
208
+ return axisApply;
209
+ },
210
+ get axis2array() {
211
+ return axis2array;
212
+ },
213
+ get centroid() {
214
+ return centroid;
215
+ },
216
+ get calcmidlineTo() {
217
+ return calcmidlineTo;
218
+ },
219
+ get midlineTo() {
220
+ return midlineTo;
221
+ },
222
+ get translator() {
223
+ return translator;
224
+ },
225
+ get calcCenterWith() {
226
+ return calcCenterWith;
227
+ },
228
+ get centerWith() {
229
+ return centerWith;
230
+ },
231
+ get getDelta() {
232
+ return getDelta;
233
+ },
234
+ get bisect() {
235
+ return bisect;
236
+ },
237
+ get slice() {
238
+ return slice;
239
+ },
240
+ get wedge() {
241
+ return wedge;
242
+ },
243
+ get stretch() {
244
+ return stretch;
245
+ },
246
+ get poly2solid() {
247
+ return poly2solid;
248
+ },
249
+ get slices2poly() {
250
+ return slices2poly;
251
+ },
252
+ get normalVector() {
253
+ return normalVector;
254
+ },
255
+ get sliceParams() {
256
+ return sliceParams;
257
+ },
258
+ get reShape() {
259
+ return reShape;
260
+ },
261
+ get chamfer() {
262
+ return chamfer;
263
+ },
264
+ get fillet() {
265
+ return fillet;
266
+ },
267
+ get calcRotate() {
268
+ return calcRotate;
269
+ },
270
+ get rotateAround() {
271
+ return rotateAround;
272
+ },
273
+ get clone() {
274
+ return clone;
275
+ },
276
+ get addConnector() {
277
+ return addConnector;
278
+ }
279
+ });
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
+ }
313
+ }
314
+ return a;
315
+ }
316
+ }
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.");
319
+ }
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);
327
+ }
328
+ return t;
329
+ }
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);
353
+ }
354
+ function _toPropertyKey(t) {
355
+ var i = _toPrimitive(t, "string");
356
+ return "symbol" == typeof i ? i : i + "";
357
+ }
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
+ }
372
+ }
373
+ var toRadians = function toRadians(deg) {
58
374
  return deg / 180 * Math.PI;
59
375
  };
60
- const toDegrees = function toDegrees(rad) {
376
+ var toDegrees = function toDegrees(rad) {
61
377
  return rad * (180 / Math.PI);
62
378
  };
63
- const solve = function(p1, p2) {
379
+ var solve = function solve(p1, p2) {
64
380
  var r = {
65
381
  c: 90,
66
382
  A: Math.abs(p2.x - p1.x),
@@ -72,7 +388,7 @@ function initJscadutils(_CSG, options = {}) {
72
388
  r.a = 90 - r.b;
73
389
  return r;
74
390
  };
75
- const solve90SA = function(r) {
391
+ var solve90SA = function solve90SA(r) {
76
392
  r = Object.assign(r, {
77
393
  C: 90
78
394
  });
@@ -84,7 +400,7 @@ function initJscadutils(_CSG, options = {}) {
84
400
  r.b = r.b || r.a / Math.tan(arad);
85
401
  return r;
86
402
  };
87
- const solve90ac = function(r) {
403
+ var solve90ac = function solve90ac(r) {
88
404
  r = Object.assign(r, {
89
405
  C: 90
90
406
  });
@@ -105,29 +421,29 @@ function initJscadutils(_CSG, options = {}) {
105
421
  }
106
422
  var triUtils = Object.freeze({
107
423
  __proto__: null,
424
+ toRadians,
425
+ toDegrees,
108
426
  solve,
109
427
  solve90SA,
110
428
  solve90ac,
111
- solveab,
112
- toDegrees,
113
- toRadians
429
+ solveab
114
430
  });
115
- const div$1 = function(a, f) {
431
+ var div$1 = function div(a, f) {
116
432
  return a.map(function(e) {
117
433
  return e / f;
118
434
  });
119
435
  };
120
- const addValue = function(a, f) {
436
+ var addValue = function addValue(a, f) {
121
437
  return a.map(function(e) {
122
438
  return e + f;
123
439
  });
124
440
  };
125
- const addArray = function(a, f) {
441
+ var addArray = function addArray(a, f) {
126
442
  return a.map(function(e, i) {
127
443
  return e + f[i];
128
444
  });
129
445
  };
130
- const add = function(a) {
446
+ var add = function add(a) {
131
447
  return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
132
448
  if (Array.isArray(arg)) {
133
449
  result = addArray(result, arg);
@@ -137,28 +453,28 @@ function initJscadutils(_CSG, options = {}) {
137
453
  return result;
138
454
  }, a);
139
455
  };
140
- const fromxyz = function(object) {
456
+ var fromxyz = function fromxyz(object) {
141
457
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
142
458
  };
143
- const toxyz = function(a) {
459
+ var toxyz = function toxyz(a) {
144
460
  return {
145
461
  x: a[0],
146
462
  y: a[1],
147
463
  z: a[2]
148
464
  };
149
465
  };
150
- const first = function(a) {
466
+ var first = function first(a) {
151
467
  return a ? a[0] : undefined;
152
468
  };
153
- const last = function(a) {
469
+ var last = function last(a) {
154
470
  return a && a.length > 0 ? a[a.length - 1] : undefined;
155
471
  };
156
- const min = function(a) {
472
+ var min = function min(a) {
157
473
  return a.reduce(function(result, value) {
158
474
  return value < result ? value : result;
159
475
  }, Number.MAX_VALUE);
160
476
  };
161
- const range = function(a, b) {
477
+ var range = function range(a, b) {
162
478
  var result = [];
163
479
  for (var i = a; i < b; i++) {
164
480
  result.push(i);
@@ -167,21 +483,21 @@ function initJscadutils(_CSG, options = {}) {
167
483
  };
168
484
  var array = Object.freeze({
169
485
  __proto__: null,
170
- add,
171
- addArray,
172
- addValue,
173
486
  div: div$1,
174
- first,
487
+ addValue,
488
+ addArray,
489
+ add,
175
490
  fromxyz,
491
+ toxyz,
492
+ first,
176
493
  last,
177
494
  min,
178
- range,
179
- toxyz
495
+ range
180
496
  });
181
- const debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
182
- const termColors = [ "\\033[0;34m", "\\033[0;32m", "\\033[0;36m", "\\033[0;31m", "\\033[0;35m", "\\033[0;33m", "\\033[1;33m", "\\033[0;30m", "\\033[1;34m" ];
497
+ var debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
498
+ var termColors = [ "\\033[0;34m", "\\033[0;32m", "\\033[0;36m", "\\033[0;31m", "\\033[0;35m", "\\033[0;33m", "\\033[1;33m", "\\033[0;30m", "\\033[1;34m" ];
183
499
  var debugCount = 0;
184
- const Debug = function(name) {
500
+ var Debug = function Debug(name) {
185
501
  var checks = Object.assign({
186
502
  enabled: [],
187
503
  disabled: [],
@@ -189,21 +505,31 @@ function initJscadutils(_CSG, options = {}) {
189
505
  browser: true
190
506
  }
191
507
  }, jscadUtilsDebug || {});
192
- var style = checks.options.browser ? `color:${debugColors[debugCount++ % debugColors.length]}` : `${termColors[debugCount++ % termColors.length]}`;
508
+ var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
193
509
  var enabled = checks.enabled.some(function checkEnabled(check) {
194
510
  return check.test(name);
195
511
  }) && !checks.disabled.some(function checkEnabled(check) {
196
512
  return check.test(name);
197
513
  });
198
- var logger = enabled ? checks.options.browser ? (...msg) => {
199
- console.log("%c%s", style, name, ...msg);
200
- } : (...msg) => {
201
- console.log(`${name}`, ...msg);
202
- } : () => undefined;
514
+ var logger = enabled ? checks.options.browser ? function() {
515
+ var _console;
516
+ for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
517
+ msg[_key] = arguments[_key];
518
+ }
519
+ (_console = console).log.apply(_console, [ "%c%s", style, name ].concat(msg));
520
+ } : function() {
521
+ var _console2;
522
+ for (var _len2 = arguments.length, msg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
523
+ msg[_key2] = arguments[_key2];
524
+ }
525
+ (_console2 = console).log.apply(_console2, [ "".concat(name) ].concat(msg));
526
+ } : function() {
527
+ return undefined;
528
+ };
203
529
  logger.enabled = enabled;
204
530
  return logger;
205
531
  };
206
- const nameArray = {
532
+ var nameArray = {
207
533
  aliceblue: "#f0f8ff",
208
534
  antiquewhite: "#faebd7",
209
535
  aqua: "#00ffff",
@@ -365,7 +691,7 @@ function initJscadutils(_CSG, options = {}) {
365
691
  return [ 0, 0, 0 ];
366
692
  }
367
693
  }
368
- const _name2rgb = {};
694
+ var _name2rgb = {};
369
695
  function name2rgb(n) {
370
696
  if (!_name2rgb[n]) _name2rgb[n] = hex2rgb(name2hex(n));
371
697
  return _name2rgb[n];
@@ -445,14 +771,23 @@ function initJscadutils(_CSG, options = {}) {
445
771
  proto.prototype.chamfer = function chamfer$1(radius, orientation, options) {
446
772
  return chamfer(this, radius, orientation, options);
447
773
  };
448
- proto.prototype.bisect = function bisect$1(...args) {
449
- return bisect(this, ...args);
774
+ proto.prototype.bisect = function bisect$1() {
775
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
776
+ args[_key] = arguments[_key];
777
+ }
778
+ return bisect.apply(util, [ this ].concat(args));
450
779
  };
451
- proto.prototype.slice = function slice$1(...args) {
452
- return slice(this, ...args);
780
+ proto.prototype.slice = function slice$1() {
781
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
782
+ args[_key2] = arguments[_key2];
783
+ }
784
+ return slice.apply(util, [ this ].concat(args));
453
785
  };
454
- proto.prototype.wedge = function wedge$1(...args) {
455
- return wedge(this, ...args);
786
+ proto.prototype.wedge = function wedge$1() {
787
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
788
+ args[_key3] = arguments[_key3];
789
+ }
790
+ return wedge.apply(util, [ this ].concat(args));
456
791
  };
457
792
  proto.prototype.stretch = function stretch$1(axis, distance, offset) {
458
793
  return stretch(this, axis, distance, offset);
@@ -469,7 +804,7 @@ function initJscadutils(_CSG, options = {}) {
469
804
  return this._translate(arguments[0]);
470
805
  } else {
471
806
  var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
472
- result = undefined.addArray(result, arg);
807
+ result = undefined(result, arg);
473
808
  return result;
474
809
  }, [ 0, 0, 0 ]);
475
810
  return this._translate(t);
@@ -478,10 +813,14 @@ function initJscadutils(_CSG, options = {}) {
478
813
  proto.prototype.addConnector = function addConnector$1(name, point, axis, normal) {
479
814
  return addConnector(this, name, point, axis, normal);
480
815
  };
481
- proto.prototype.connect = function connectTo(myConnectorName, otherConnector, mirror = false, normalrotation = 0) {
482
- var myConnector = myConnectorName.split(".").reduce((a, v) => a[v], this.properties);
816
+ proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
817
+ var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
818
+ var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
819
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
820
+ return a[v];
821
+ }, this.properties);
483
822
  if (!myConnector) {
484
- error(`The connector '${myConnectorName}' does not exist on the object [${Object.keys(this.properties).join(",")}]`, "Missing connector property");
823
+ error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
485
824
  }
486
825
  return this.connectTo(myConnector, otherConnector, mirror, normalrotation);
487
826
  };
@@ -491,13 +830,16 @@ function initJscadutils(_CSG, options = {}) {
491
830
  __proto__: null,
492
831
  default: init
493
832
  });
494
- const {CSG, CAG} = jsCadCSG;
495
- const {rectangular_extrude} = scadApi.extrusions;
496
- const {vector_text, vector_char} = scadApi.text;
497
- const {union} = scadApi.booleanOps;
833
+ var CSG = jsCadCSG__default["default"].CSG, CAG = jsCadCSG__default["default"].CAG;
834
+ var rectangular_extrude = scadApi__default["default"].extrusions.rectangular_extrude;
835
+ var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
836
+ var union = scadApi__default["default"].booleanOps.union;
498
837
  init(CSG);
499
- const debug$3 = Debug("jscadUtils:group");
500
- function JsCadUtilsGroup(names = [], parts = {}, holes = []) {
838
+ var debug$3 = Debug("jscadUtils:group");
839
+ function JsCadUtilsGroup() {
840
+ var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
841
+ var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
842
+ var holes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
501
843
  this.name = "";
502
844
  this.names = names;
503
845
  this.parts = parts;
@@ -525,7 +867,11 @@ function initJscadutils(_CSG, options = {}) {
525
867
  }
526
868
  return self;
527
869
  };
528
- JsCadUtilsGroup.prototype.combine = function(pieces, options = {}, map = x => x) {
870
+ JsCadUtilsGroup.prototype.combine = function(pieces) {
871
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
872
+ var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function(x) {
873
+ return x;
874
+ };
529
875
  try {
530
876
  var self = this;
531
877
  options = Object.assign({
@@ -533,7 +879,7 @@ function initJscadutils(_CSG, options = {}) {
533
879
  }, options);
534
880
  pieces = pieces ? pieces.split(",") : self.names;
535
881
  if (pieces.length === 0) {
536
- throw new Error(`no pieces found in ${self.name} pieces: ${pieces} parts: ${Object.keys(self.parts)} names: ${self.names}`);
882
+ throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
537
883
  }
538
884
  debug$3("combine", self.names, self.parts);
539
885
  var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
@@ -543,12 +889,14 @@ function initJscadutils(_CSG, options = {}) {
543
889
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
544
890
  } catch (err) {
545
891
  debug$3("combine error", this, pieces, options, err);
546
- throw error(`group::combine error "${err.message || err.toString()}"\nthis: ${this}\npieces: "${pieces}"\noptions: ${JSON.stringify(options, null, 2)}\nstack: ${err.stack}\n`, "JSCAD_UTILS_GROUP_ERROR");
892
+ 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");
547
893
  }
548
894
  };
549
895
  JsCadUtilsGroup.prototype.map = function(cb) {
550
896
  var self = this;
551
- self.parts = Object.keys(self.parts).filter(k => k !== "holes").reduce(function(result, key) {
897
+ self.parts = Object.keys(self.parts).filter(function(k) {
898
+ return k !== "holes";
899
+ }).reduce(function(result, key) {
552
900
  result[key] = cb(self.parts[key], key);
553
901
  return result;
554
902
  }, {});
@@ -564,7 +912,7 @@ function initJscadutils(_CSG, options = {}) {
564
912
  return self;
565
913
  };
566
914
  JsCadUtilsGroup.prototype.clone = function(name, map) {
567
- debug$3("clone", name, typeof name, map);
915
+ debug$3("clone", name, _typeof(name), map);
568
916
  var self = this;
569
917
  if (typeof name == "function") {
570
918
  map = name;
@@ -616,7 +964,7 @@ function initJscadutils(_CSG, options = {}) {
616
964
  return self;
617
965
  } catch (err) {
618
966
  debug$3("snap error", this, part, to, axis, delta, err);
619
- throw error(`group::snap error "${err.message || err.toString()}"\nthis: ${this}\npart: "${part}"\nto: ${to}\naxis: "${axis}"\norientation: "${orientation}"\ndelta: "${delta}"\nstack: ${err.stack}\n`, "JSCAD_UTILS_GROUP_ERROR");
967
+ 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");
620
968
  }
621
969
  };
622
970
  JsCadUtilsGroup.prototype.align = function align(part, to, axis, delta) {
@@ -631,7 +979,7 @@ function initJscadutils(_CSG, options = {}) {
631
979
  return self;
632
980
  } catch (err) {
633
981
  debug$3("align error", this, part, to, axis, delta, err);
634
- throw error(`group::align error "${err.message || err.toString()}"\nthis: ${this}\npart: "${part}"\nto: ${to}\naxis: "${axis}"\ndelta: "${delta}"\nstack: ${err.stack}\n`, "JSCAD_UTILS_GROUP_ERROR");
982
+ 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");
635
983
  }
636
984
  };
637
985
  JsCadUtilsGroup.prototype.center = function center(part) {
@@ -643,7 +991,9 @@ function initJscadutils(_CSG, options = {}) {
643
991
  var bounds = self.parts[part].getBounds();
644
992
  return self.translate([ 0, 0, -bounds[0].z ]);
645
993
  };
646
- JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName, mirror = true, normalrotation = 0) {
994
+ JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
995
+ var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
996
+ var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
647
997
  debug$3("connectTo", {
648
998
  partName,
649
999
  connectorName,
@@ -653,9 +1003,13 @@ function initJscadutils(_CSG, options = {}) {
653
1003
  normalrotation
654
1004
  });
655
1005
  var self = this;
656
- var myConnector = connectorName.split(".").reduce((a, v) => a[v], self.parts[partName].properties);
1006
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1007
+ return a[v];
1008
+ }, self.parts[partName].properties);
657
1009
  debug$3("toConnector", to instanceof CSG.Connector);
658
- var toConnector = toConnectorName.split(".").reduce((a, v) => a[v], to.properties);
1010
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1011
+ return a[v];
1012
+ }, to.properties);
659
1013
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
660
1014
  debug$3("connectTo", matrix);
661
1015
  self.map(function(part) {
@@ -694,14 +1048,15 @@ function initJscadutils(_CSG, options = {}) {
694
1048
  return g;
695
1049
  };
696
1050
  JsCadUtilsGroup.prototype.array = function(parts, map) {
1051
+ var _this = this;
697
1052
  var self = this;
698
1053
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
699
1054
  if (!map) map = identity;
700
1055
  var a = [];
701
- p.forEach(name => {
1056
+ p.forEach(function(name) {
702
1057
  if (!self.parts[name]) {
703
- debug$3("array error", this, parts);
704
- throw error(`group::array error "${name}" not found.\nthis: ${this}\nparts: "${parts}"\n`, "JSCAD_UTILS_GROUP_ERROR");
1058
+ debug$3("array error", _this, parts);
1059
+ throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
705
1060
  }
706
1061
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
707
1062
  });
@@ -711,12 +1066,12 @@ function initJscadutils(_CSG, options = {}) {
711
1066
  var self = this;
712
1067
  var piecesArray = pieces ? pieces.split(",") : self.names;
713
1068
  return piecesArray.map(function(piece) {
714
- if (!self.parts[piece]) console.error(`Cannot find ${piece} in ${self.names}`);
1069
+ if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
715
1070
  return self.parts[piece];
716
1071
  });
717
1072
  };
718
1073
  JsCadUtilsGroup.prototype.toString = function() {
719
- return `{\n name: "${this.name}",\n names: "${this.names.join(",")}", \n parts: "${Object.keys(this.parts)}",\n holes: ${Array.isArray(this.holes) ? this.holes.length : this.holes ? 1 : 0}\n}`;
1074
+ 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}");
720
1075
  };
721
1076
  JsCadUtilsGroup.prototype.setName = function(name) {
722
1077
  this.name = name;
@@ -746,7 +1101,9 @@ function initJscadutils(_CSG, options = {}) {
746
1101
  self.name = objectNames;
747
1102
  } else {
748
1103
  var objects = objectNames;
749
- self.names = Object.keys(objects).filter(k => k !== "holes");
1104
+ self.names = Object.keys(objects).filter(function(k) {
1105
+ return k !== "holes";
1106
+ });
750
1107
  self.parts = Object.assign({}, objects);
751
1108
  self.holes = objects.holes;
752
1109
  }
@@ -754,13 +1111,17 @@ function initJscadutils(_CSG, options = {}) {
754
1111
  }
755
1112
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
756
1113
  }
757
- const debug$2 = Debug("jscadUtils:util");
1114
+ var debug$2 = Debug("jscadUtils:util");
758
1115
  var NOZZEL_SIZE = .4;
759
- const nearest = {
760
- under: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1116
+ var nearest = {
1117
+ under: function under(desired) {
1118
+ var nozzel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NOZZEL_SIZE;
1119
+ var nozzie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
761
1120
  return (Math.floor(desired / nozzel) + nozzie) * nozzel;
762
1121
  },
763
- over: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1122
+ over: function over(desired) {
1123
+ var nozzel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NOZZEL_SIZE;
1124
+ var nozzie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
764
1125
  return (Math.ceil(desired / nozzel) + nozzie) * nozzel;
765
1126
  }
766
1127
  };
@@ -788,9 +1149,9 @@ function initJscadutils(_CSG, options = {}) {
788
1149
  debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
789
1150
  }
790
1151
  function jscadToString(o) {
791
- if (typeof o == "object") {
1152
+ if (_typeof(o) == "object") {
792
1153
  if (o.polygons) {
793
- return `{\npolygons: ${o.polygons.length},\nproperties: "${Object.keys(o.properties)}"\n}\n`;
1154
+ return "{\npolygons: ".concat(o.polygons.length, ',\nproperties: "').concat(Object.keys(o.properties), '"\n}\n');
794
1155
  }
795
1156
  } else {
796
1157
  return o.toString();
@@ -831,12 +1192,12 @@ function initJscadutils(_CSG, options = {}) {
831
1192
  }
832
1193
  function text(text) {
833
1194
  var l = vector_char(0, 0, text);
834
- var char = l.segments.reduce(function(result, segment) {
1195
+ var _char = l.segments.reduce(function(result, segment) {
835
1196
  var path = new CSG.Path2D(segment);
836
1197
  var cag = path.expandToCAG(2);
837
1198
  return result ? result.union(cag) : cag;
838
1199
  }, undefined);
839
- return char;
1200
+ return _char;
840
1201
  }
841
1202
  function unitCube(length, radius) {
842
1203
  radius = radius || .5;
@@ -892,7 +1253,7 @@ function initJscadutils(_CSG, options = {}) {
892
1253
  function mapPick(o, names, f, options) {
893
1254
  return names.reduce(function(result, name, index) {
894
1255
  if (!o[name]) {
895
- throw new Error(`${name} not found in ${options.name}: ${Object.keys(o).join(",")}`);
1256
+ throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
896
1257
  }
897
1258
  result.push(f ? f(o[name], name, index, o) : o[name]);
898
1259
  return result;
@@ -924,7 +1285,7 @@ function initJscadutils(_CSG, options = {}) {
924
1285
  function xyz2array(size) {
925
1286
  return [ size.x, size.y, size.z ];
926
1287
  }
927
- const rotationAxes = {
1288
+ var rotationAxes = {
928
1289
  x: [ 1, 0, 0 ],
929
1290
  y: [ 0, 1, 0 ],
930
1291
  z: [ 0, 0, 1 ]
@@ -1002,7 +1363,7 @@ function initJscadutils(_CSG, options = {}) {
1002
1363
  function mirrored4(x) {
1003
1364
  return x.union([ x.mirroredY(90), x.mirroredX(90), x.mirroredY(90).mirroredX(90) ]);
1004
1365
  }
1005
- const flushSide = {
1366
+ var flushSide = {
1006
1367
  "above-outside": [ 1, 0 ],
1007
1368
  "above-inside": [ 1, 1 ],
1008
1369
  "below-outside": [ 0, 1 ],
@@ -1032,7 +1393,8 @@ function initJscadutils(_CSG, options = {}) {
1032
1393
  return w[side[0]][axis] - m[side[1]][axis];
1033
1394
  });
1034
1395
  }
1035
- function calcSnap(moveobj, withobj, axes, orientation, delta = 0) {
1396
+ function calcSnap(moveobj, withobj, axes, orientation) {
1397
+ var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1036
1398
  var side = flushSide[orientation];
1037
1399
  if (!side) {
1038
1400
  var fix = {
@@ -1098,7 +1460,7 @@ function initJscadutils(_CSG, options = {}) {
1098
1460
  objectSize = objectSize || size(bounds);
1099
1461
  return bounds[0].plus(objectSize.dividedBy(2));
1100
1462
  } catch (err) {
1101
- error(`centroid error o:${jscadToString(o)} objectSize: ${objectSize}`, undefined, err);
1463
+ error("centroid error o:".concat(jscadToString(o), " objectSize: ").concat(objectSize), undefined, err);
1102
1464
  }
1103
1465
  }
1104
1466
  function calcmidlineTo(o, axis, to) {
@@ -1119,7 +1481,8 @@ function initJscadutils(_CSG, options = {}) {
1119
1481
  });
1120
1482
  return t;
1121
1483
  }
1122
- function calcCenterWith(o, axes, withObj, delta = 0) {
1484
+ function calcCenterWith(o, axes, withObj) {
1485
+ var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1123
1486
  var objectCentroid = centroid(o);
1124
1487
  var withCentroid = centroid(withObj);
1125
1488
  var t = axisApply(axes, function(i, axis) {
@@ -1141,7 +1504,10 @@ function initJscadutils(_CSG, options = {}) {
1141
1504
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1142
1505
  });
1143
1506
  }
1144
- function bisect(...args) {
1507
+ function bisect() {
1508
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1509
+ args[_key] = arguments[_key];
1510
+ }
1145
1511
  if (args.length < 2) {
1146
1512
  error("bisect requires an object and an axis", "JSCAD_UTILS_INVALID_ARGS");
1147
1513
  }
@@ -1222,10 +1588,14 @@ function initJscadutils(_CSG, options = {}) {
1222
1588
  if (options.addRotationCenter) g.add(unitAxis(objectSize.length() + 10, .1, rotationCenter), "rotationCenter");
1223
1589
  return g;
1224
1590
  }
1225
- function slice(object, angle = 15, axis = "x", rotateaxis = "z", options = {
1226
- color: true,
1227
- addRotationCenter: true
1228
- }) {
1591
+ function slice(object) {
1592
+ var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;
1593
+ var axis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "x";
1594
+ var rotateaxis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "z";
1595
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
1596
+ color: true,
1597
+ addRotationCenter: true
1598
+ };
1229
1599
  var info = normalVector(axis);
1230
1600
  var rotationCenter = options.rotationCenter || new CSG.Vector3D(0, 0, 0);
1231
1601
  var theRotationAxis = rotationAxes[rotateaxis];
@@ -1442,11 +1812,12 @@ function initJscadutils(_CSG, options = {}) {
1442
1812
  };
1443
1813
  }
1444
1814
  function rotateAround(part, solid, axis, angle) {
1445
- var {rotationCenter, rotationAxis} = calcRotate(part, solid, axis);
1815
+ var _calcRotate = calcRotate(part, solid, axis), rotationCenter = _calcRotate.rotationCenter, rotationAxis = _calcRotate.rotationAxis;
1446
1816
  return part.rotate(rotationCenter, rotationAxis, angle);
1447
1817
  }
1448
- function cloneProperties(from, to, depth = 0) {
1449
- return Object.entries(from).reduce((props, [key, value]) => {
1818
+ function cloneProperties(from, to) {
1819
+ return Object.entries(from).reduce(function(props, _ref) {
1820
+ var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1450
1821
  props[key] = value;
1451
1822
  return props;
1452
1823
  }, to);
@@ -1457,85 +1828,14 @@ function initJscadutils(_CSG, options = {}) {
1457
1828
  debug$2("clone", o, c, CSG);
1458
1829
  return c;
1459
1830
  }
1460
- function addConnector(object, name, point = [ 0, 0, 0 ], axis = [ 1, 0, 0 ], normal = [ 0, 0, 1 ]) {
1831
+ function addConnector(object, name) {
1832
+ var point = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [ 0, 0, 0 ];
1833
+ var axis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [ 1, 0, 0 ];
1834
+ var normal = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [ 0, 0, 1 ];
1461
1835
  object.properties[name] = new CSG.Connector(point, axis, normal);
1462
1836
  return object;
1463
1837
  }
1464
- var util = Object.freeze({
1465
- __proto__: null,
1466
- NOZZEL_SIZE,
1467
- addConnector,
1468
- axis2array,
1469
- axisApply,
1470
- bisect,
1471
- calcCenterWith,
1472
- calcFlush,
1473
- calcRotate,
1474
- calcSnap,
1475
- calcmidlineTo,
1476
- center,
1477
- centerWith,
1478
- centerX,
1479
- centerY,
1480
- centroid,
1481
- chamfer,
1482
- clone,
1483
- cm,
1484
- defaults,
1485
- depreciated,
1486
- div,
1487
- divA,
1488
- divxyz,
1489
- enlarge,
1490
- error,
1491
- fillet,
1492
- fit,
1493
- flush,
1494
- flushSide,
1495
- getDelta,
1496
- identity,
1497
- ifArray,
1498
- inch,
1499
- isEmpty,
1500
- isNegative,
1501
- jscadToString,
1502
- label,
1503
- map,
1504
- mapPick,
1505
- mapValues,
1506
- midlineTo,
1507
- mirrored4,
1508
- mul,
1509
- mulxyz,
1510
- nearest,
1511
- normalVector,
1512
- pick,
1513
- poly2solid,
1514
- print,
1515
- reShape,
1516
- result,
1517
- rotateAround,
1518
- rotationAxes,
1519
- scale,
1520
- segment,
1521
- shift,
1522
- size,
1523
- slice,
1524
- sliceParams,
1525
- slices2poly,
1526
- snap,
1527
- stretch,
1528
- text,
1529
- toArray,
1530
- translator,
1531
- unitAxis,
1532
- unitCube,
1533
- wedge,
1534
- xyz2array,
1535
- zero,
1536
- zipObject
1537
- });
1538
- const debug$1 = Debug("jscadUtils:parts");
1838
+ var debug$1 = Debug("jscadUtils:parts");
1539
1839
  var parts = {
1540
1840
  BBox: BBox$1,
1541
1841
  Cube,
@@ -1543,13 +1843,16 @@ function initJscadutils(_CSG, options = {}) {
1543
1843
  Cylinder,
1544
1844
  Cone
1545
1845
  };
1546
- function BBox$1(...objects) {
1846
+ function BBox$1() {
1547
1847
  function box(object) {
1548
1848
  return CSG.cube({
1549
1849
  center: object.centroid(),
1550
1850
  radius: object.size().dividedBy(2)
1551
1851
  });
1552
1852
  }
1853
+ for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1854
+ objects[_key] = arguments[_key];
1855
+ }
1553
1856
  return objects.reduce(function(bbox, part) {
1554
1857
  var object = bbox ? union([ bbox, box(part) ]) : part;
1555
1858
  return box(object);
@@ -1582,7 +1885,8 @@ function initJscadutils(_CSG, options = {}) {
1582
1885
  });
1583
1886
  return roundedcube;
1584
1887
  }
1585
- function Cylinder(diameter, height, options = {}) {
1888
+ function Cylinder(diameter, height) {
1889
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1586
1890
  debug$1("parts.Cylinder", diameter, height, options);
1587
1891
  options = Object.assign({
1588
1892
  start: [ 0, 0, 0 ],
@@ -1592,7 +1896,8 @@ function initJscadutils(_CSG, options = {}) {
1592
1896
  }, options);
1593
1897
  return CSG.cylinder(options);
1594
1898
  }
1595
- function Cone(diameter1, diameter2, height, options = {}) {
1899
+ function Cone(diameter1, diameter2, height) {
1900
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1596
1901
  debug$1("parts.Cone", diameter1, diameter2, height, options);
1597
1902
  return CSG.cylinder(Object.assign({
1598
1903
  start: [ 0, 0, 0 ],
@@ -1621,7 +1926,9 @@ function initJscadutils(_CSG, options = {}) {
1621
1926
  function Tube(outsideDiameter, insideDiameter, height, outsideOptions, insideOptions) {
1622
1927
  return Cylinder(outsideDiameter, height, outsideOptions).subtract(Cylinder(insideDiameter, height, insideOptions || outsideOptions));
1623
1928
  }
1624
- function Anchor(width = 10, height = 10) {
1929
+ function Anchor() {
1930
+ var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
1931
+ var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
1625
1932
  var hole = Cylinder(width, height).Center().color("red");
1626
1933
  var post = Cylinder(height / 2, width * .66).rotateX(90).align(hole, "xz").snap(hole, "y", "inside-").translate([ 0, 0, -height / 6 ]).color("purple");
1627
1934
  return Group({
@@ -1641,7 +1948,7 @@ function initJscadutils(_CSG, options = {}) {
1641
1948
  });
1642
1949
  return board;
1643
1950
  }
1644
- const Hardware = {
1951
+ var Hardware = {
1645
1952
  Orientation: {
1646
1953
  up: {
1647
1954
  head: "outside-",
@@ -1652,7 +1959,7 @@ function initJscadutils(_CSG, options = {}) {
1652
1959
  clear: "inside-"
1653
1960
  }
1654
1961
  },
1655
- Screw: function(head, thread, headClearSpace, options) {
1962
+ Screw: function Screw(head, thread, headClearSpace, options) {
1656
1963
  depreciated("Screw", false, "Use the jscad-hardware screw methods instead");
1657
1964
  options = Object.assign(options, {
1658
1965
  orientation: "up",
@@ -1668,7 +1975,7 @@ function initJscadutils(_CSG, options = {}) {
1668
1975
  }
1669
1976
  return group;
1670
1977
  },
1671
- PanHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1978
+ PanHeadScrew: function PanHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1672
1979
  depreciated("PanHeadScrew", false, "Use the jscad-hardware screw methods instead");
1673
1980
  var head = Cylinder(headDiameter, headLength);
1674
1981
  var thread = Cylinder(diameter, length);
@@ -1677,7 +1984,7 @@ function initJscadutils(_CSG, options = {}) {
1677
1984
  }
1678
1985
  return Hardware.Screw(head, thread, headClearSpace, options);
1679
1986
  },
1680
- HexHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1987
+ HexHeadScrew: function HexHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1681
1988
  depreciated("HexHeadScrew", false, "Use the jscad-hardware screw methods instead");
1682
1989
  var head = Hexagon(headDiameter, headLength);
1683
1990
  var thread = Cylinder(diameter, length);
@@ -1686,7 +1993,7 @@ function initJscadutils(_CSG, options = {}) {
1686
1993
  }
1687
1994
  return Hardware.Screw(head, thread, headClearSpace, options);
1688
1995
  },
1689
- FlatHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1996
+ FlatHeadScrew: function FlatHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1690
1997
  depreciated("FlatHeadScrew", false, "Use the jscad-hardware screw methods instead");
1691
1998
  var head = Cone(headDiameter, diameter, headLength);
1692
1999
  var thread = Cylinder(diameter, length);
@@ -1698,20 +2005,20 @@ function initJscadutils(_CSG, options = {}) {
1698
2005
  };
1699
2006
  var parts$1 = Object.freeze({
1700
2007
  __proto__: null,
1701
- Anchor,
2008
+ default: parts,
1702
2009
  BBox: BBox$1,
1703
- Board,
1704
- Cone,
1705
2010
  Cube,
2011
+ RoundedCube,
1706
2012
  Cylinder,
1707
- Hardware,
2013
+ Cone,
1708
2014
  Hexagon,
1709
- RoundedCube,
1710
2015
  Triangle,
1711
2016
  Tube,
1712
- default: parts
2017
+ Anchor,
2018
+ Board,
2019
+ Hardware
1713
2020
  });
1714
- const debug = Debug("jscadUtils:boxes");
2021
+ var debug = Debug("jscadUtils:boxes");
1715
2022
  function RabbetJoin(box, thickness, cutHeight) {
1716
2023
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
1717
2024
  return rabbetJoin(box, thickness, cutHeight);
@@ -1724,16 +2031,17 @@ function initJscadutils(_CSG, options = {}) {
1724
2031
  var top = bottom.parts.positive.bisect("z", -thickness);
1725
2032
  return Group("top,middle,bottom", [ top.parts.positive, top.parts.negative.color("green"), bottom.parts.negative ]);
1726
2033
  }
1727
- function Rabett(box, thickness, gap, height, face, options = {}) {
2034
+ function Rabett(box, thickness, gap, height, face) {
2035
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
1728
2036
  debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
1729
2037
  gap = gap || .25;
1730
2038
  var inside = thickness - gap;
1731
2039
  var outside = -thickness + gap;
1732
2040
  debug("inside", inside, "outside", outside);
1733
2041
  var group = Group();
1734
- var {positive: top, negative: lower2_3rd} = box.bisect("z", height, options).parts;
2042
+ var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
1735
2043
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
1736
- var {positive: middle, negative: bottom} = lower2_3rd.bisect("z", lowerBisectHeight, options).parts;
2044
+ var _lower2_3rd$bisect$pa = lower2_3rd.bisect("z", lowerBisectHeight, options).parts, middle = _lower2_3rd$bisect$pa.positive, bottom = _lower2_3rd$bisect$pa.negative;
1737
2045
  var middleTop = middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]));
1738
2046
  group.add(top.union(middleTop), "top");
1739
2047
  var bottomOutline = middle.color("yellow").subtract(middle.color("orange").enlarge([ outside, outside, 0 ])).enlarge([ outside, outside, 0 ]);
@@ -1742,7 +2050,9 @@ function initJscadutils(_CSG, options = {}) {
1742
2050
  group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ])).subtract(middleTop)), "bottom");
1743
2051
  return group;
1744
2052
  }
1745
- const RabettTopBottom = function rabbetTMB(box, thickness, gap = .25, options = {}) {
2053
+ var RabettTopBottom = function rabbetTMB(box, thickness) {
2054
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
2055
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1746
2056
  options = Object.assign({
1747
2057
  removableTop: true,
1748
2058
  removableBottom: true,
@@ -1775,7 +2085,7 @@ function initJscadutils(_CSG, options = {}) {
1775
2085
  }
1776
2086
  return group;
1777
2087
  };
1778
- const CutOut = function cutOut(o, h, box, plug, gap) {
2088
+ var CutOut = function cutOut(o, h, box, plug, gap) {
1779
2089
  gap = gap || .25;
1780
2090
  var s = o.size();
1781
2091
  var cutout = o.intersect(box);
@@ -1793,7 +2103,7 @@ function initJscadutils(_CSG, options = {}) {
1793
2103
  insert: union([ o, top ]).intersect(box).subtract(o).enlarge([ -gap, 0, 0 ]).union(clip.subtract(plug).enlarge(-gap, -gap, 0)).color("blue")
1794
2104
  });
1795
2105
  };
1796
- const Rectangle = function(size, thickness, cb) {
2106
+ var Rectangle = function Rectangle(size, thickness, cb) {
1797
2107
  thickness = thickness || 2;
1798
2108
  var s = div$1(xyz2array(size), 2);
1799
2109
  var r = add(s, thickness);
@@ -1807,7 +2117,7 @@ function initJscadutils(_CSG, options = {}) {
1807
2117
  if (cb) box = cb(box);
1808
2118
  return box;
1809
2119
  };
1810
- const Hollow = function(object, thickness, interiorcb, exteriorcb) {
2120
+ var Hollow = function Hollow(object, thickness, interiorcb, exteriorcb) {
1811
2121
  thickness = thickness || 2;
1812
2122
  var size = -thickness * 2;
1813
2123
  interiorcb = interiorcb || identity;
@@ -1815,7 +2125,7 @@ function initJscadutils(_CSG, options = {}) {
1815
2125
  if (exteriorcb) box = exteriorcb(box);
1816
2126
  return box;
1817
2127
  };
1818
- const BBox = function(o) {
2128
+ var BBox = function BBox(o) {
1819
2129
  depreciated("BBox", true, "Use 'parts.BBox' instead");
1820
2130
  var s = div$1(xyz2array(o.size()), 2);
1821
2131
  return CSG.cube({
@@ -1826,7 +2136,8 @@ function initJscadutils(_CSG, options = {}) {
1826
2136
  function getRadius(o) {
1827
2137
  return div$1(xyz2array(o.size()), 2);
1828
2138
  }
1829
- function rabbetJoin(box, thickness, gap = .25) {
2139
+ function rabbetJoin(box, thickness) {
2140
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
1830
2141
  var r = add(getRadius(box), -thickness / 2);
1831
2142
  r[2] = thickness / 2;
1832
2143
  var cutter = CSG.cube({
@@ -1844,17 +2155,16 @@ function initJscadutils(_CSG, options = {}) {
1844
2155
  }
1845
2156
  var Boxes = Object.freeze({
1846
2157
  __proto__: null,
1847
- BBox,
1848
- CutOut,
1849
- Hollow,
1850
2158
  RabbetJoin,
2159
+ topMiddleBottom,
1851
2160
  Rabett,
1852
2161
  RabettTopBottom,
2162
+ CutOut,
1853
2163
  Rectangle,
1854
- topMiddleBottom
2164
+ Hollow,
2165
+ BBox
1855
2166
  });
1856
- const compatV1 = {
1857
- ...util,
2167
+ var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
1858
2168
  group: Group,
1859
2169
  init: init$1,
1860
2170
  triangle: triUtils,
@@ -1862,7 +2172,7 @@ function initJscadutils(_CSG, options = {}) {
1862
2172
  parts: parts$1,
1863
2173
  Boxes,
1864
2174
  Debug
1865
- };
2175
+ });
1866
2176
  exports.Boxes = Boxes;
1867
2177
  exports.Debug = Debug;
1868
2178
  exports.Group = Group;
@@ -1872,6 +2182,9 @@ function initJscadutils(_CSG, options = {}) {
1872
2182
  exports.parts = parts$1;
1873
2183
  exports.triUtils = triUtils;
1874
2184
  exports.util = util;
2185
+ Object.defineProperty(exports, "__esModule", {
2186
+ value: true
2187
+ });
1875
2188
  return exports;
1876
2189
  }({}, jsCadCSG, scadApi);
1877
2190
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
@@ -1889,7 +2202,7 @@ function initJscadutils(_CSG, options = {}) {
1889
2202
 
1890
2203
  var jscadUtilsPluginInit = [];
1891
2204
 
1892
- util = {
2205
+ var util = {
1893
2206
  init: (...a) => {
1894
2207
  initJscadutils(...a);
1895
2208
  jscadUtilsPluginInit.forEach(p => {