@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.
@@ -50,13 +50,329 @@ function initJscadutils(_CSG, options = {}) {
50
50
  });
51
51
  var jscadUtils = function(exports, jsCadCSG, scadApi) {
52
52
  "use strict";
53
- const toRadians = function toRadians(deg) {
53
+ function _interopDefaultLegacy(e) {
54
+ return e && typeof e === "object" && "default" in e ? e : {
55
+ default: e
56
+ };
57
+ }
58
+ var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
59
+ var scadApi__default = _interopDefaultLegacy(scadApi);
60
+ var util = Object.freeze({
61
+ __proto__: null,
62
+ get NOZZEL_SIZE() {
63
+ return NOZZEL_SIZE;
64
+ },
65
+ get nearest() {
66
+ return nearest;
67
+ },
68
+ get identity() {
69
+ return identity;
70
+ },
71
+ get result() {
72
+ return result;
73
+ },
74
+ get defaults() {
75
+ return defaults;
76
+ },
77
+ get isEmpty() {
78
+ return isEmpty;
79
+ },
80
+ get isNegative() {
81
+ return isNegative;
82
+ },
83
+ get print() {
84
+ return print;
85
+ },
86
+ get jscadToString() {
87
+ return jscadToString;
88
+ },
89
+ get error() {
90
+ return error;
91
+ },
92
+ get depreciated() {
93
+ return depreciated;
94
+ },
95
+ get inch() {
96
+ return inch;
97
+ },
98
+ get cm() {
99
+ return cm;
100
+ },
101
+ get label() {
102
+ return label;
103
+ },
104
+ get text() {
105
+ return text;
106
+ },
107
+ get unitCube() {
108
+ return unitCube;
109
+ },
110
+ get unitAxis() {
111
+ return unitAxis;
112
+ },
113
+ get toArray() {
114
+ return toArray;
115
+ },
116
+ get ifArray() {
117
+ return ifArray;
118
+ },
119
+ get segment() {
120
+ return segment;
121
+ },
122
+ get zipObject() {
123
+ return zipObject;
124
+ },
125
+ get map() {
126
+ return map;
127
+ },
128
+ get mapValues() {
129
+ return mapValues;
130
+ },
131
+ get pick() {
132
+ return pick;
133
+ },
134
+ get mapPick() {
135
+ return mapPick;
136
+ },
137
+ get divA() {
138
+ return divA;
139
+ },
140
+ get divxyz() {
141
+ return divxyz;
142
+ },
143
+ get div() {
144
+ return div;
145
+ },
146
+ get mulxyz() {
147
+ return mulxyz;
148
+ },
149
+ get mul() {
150
+ return mul;
151
+ },
152
+ get xyz2array() {
153
+ return xyz2array;
154
+ },
155
+ get rotationAxes() {
156
+ return rotationAxes;
157
+ },
158
+ get size() {
159
+ return size;
160
+ },
161
+ get scale() {
162
+ return scale;
163
+ },
164
+ get center() {
165
+ return center;
166
+ },
167
+ get centerY() {
168
+ return centerY;
169
+ },
170
+ get centerX() {
171
+ return centerX;
172
+ },
173
+ get enlarge() {
174
+ return enlarge;
175
+ },
176
+ get fit() {
177
+ return fit;
178
+ },
179
+ get shift() {
180
+ return shift;
181
+ },
182
+ get zero() {
183
+ return zero;
184
+ },
185
+ get mirrored4() {
186
+ return mirrored4;
187
+ },
188
+ get flushSide() {
189
+ return flushSide;
190
+ },
191
+ get calcFlush() {
192
+ return calcFlush;
193
+ },
194
+ get calcSnap() {
195
+ return calcSnap;
196
+ },
197
+ get snap() {
198
+ return snap;
199
+ },
200
+ get flush() {
201
+ return flush;
202
+ },
203
+ get axisApply() {
204
+ return axisApply;
205
+ },
206
+ get axis2array() {
207
+ return axis2array;
208
+ },
209
+ get centroid() {
210
+ return centroid;
211
+ },
212
+ get calcmidlineTo() {
213
+ return calcmidlineTo;
214
+ },
215
+ get midlineTo() {
216
+ return midlineTo;
217
+ },
218
+ get translator() {
219
+ return translator;
220
+ },
221
+ get calcCenterWith() {
222
+ return calcCenterWith;
223
+ },
224
+ get centerWith() {
225
+ return centerWith;
226
+ },
227
+ get getDelta() {
228
+ return getDelta;
229
+ },
230
+ get bisect() {
231
+ return bisect;
232
+ },
233
+ get slice() {
234
+ return slice;
235
+ },
236
+ get wedge() {
237
+ return wedge;
238
+ },
239
+ get stretch() {
240
+ return stretch;
241
+ },
242
+ get poly2solid() {
243
+ return poly2solid;
244
+ },
245
+ get slices2poly() {
246
+ return slices2poly;
247
+ },
248
+ get normalVector() {
249
+ return normalVector;
250
+ },
251
+ get sliceParams() {
252
+ return sliceParams;
253
+ },
254
+ get reShape() {
255
+ return reShape;
256
+ },
257
+ get chamfer() {
258
+ return chamfer;
259
+ },
260
+ get fillet() {
261
+ return fillet;
262
+ },
263
+ get calcRotate() {
264
+ return calcRotate;
265
+ },
266
+ get rotateAround() {
267
+ return rotateAround;
268
+ },
269
+ get clone() {
270
+ return clone;
271
+ },
272
+ get addConnector() {
273
+ return addConnector;
274
+ }
275
+ });
276
+ function _arrayLikeToArray(r, a) {
277
+ (null == a || a > r.length) && (a = r.length);
278
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
279
+ return n;
280
+ }
281
+ function _arrayWithHoles(r) {
282
+ if (Array.isArray(r)) return r;
283
+ }
284
+ function _defineProperty(e, r, t) {
285
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
286
+ value: t,
287
+ enumerable: !0,
288
+ configurable: !0,
289
+ writable: !0
290
+ }) : e[r] = t, e;
291
+ }
292
+ function _iterableToArrayLimit(r, l) {
293
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
294
+ if (null != t) {
295
+ var e, n, i, u, a = [], f = !0, o = !1;
296
+ try {
297
+ if (i = (t = t.call(r)).next, 0 === l) {
298
+ if (Object(t) !== t) return;
299
+ f = !1;
300
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
301
+ } catch (r) {
302
+ o = !0, n = r;
303
+ } finally {
304
+ try {
305
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
306
+ } finally {
307
+ if (o) throw n;
308
+ }
309
+ }
310
+ return a;
311
+ }
312
+ }
313
+ function _nonIterableRest() {
314
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
315
+ }
316
+ function ownKeys(e, r) {
317
+ var t = Object.keys(e);
318
+ if (Object.getOwnPropertySymbols) {
319
+ var o = Object.getOwnPropertySymbols(e);
320
+ r && (o = o.filter(function(r) {
321
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
322
+ })), t.push.apply(t, o);
323
+ }
324
+ return t;
325
+ }
326
+ function _objectSpread2(e) {
327
+ for (var r = 1; r < arguments.length; r++) {
328
+ var t = null != arguments[r] ? arguments[r] : {};
329
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
330
+ _defineProperty(e, r, t[r]);
331
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
332
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
333
+ });
334
+ }
335
+ return e;
336
+ }
337
+ function _slicedToArray(r, e) {
338
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
339
+ }
340
+ function _toPrimitive(t, r) {
341
+ if ("object" != typeof t || !t) return t;
342
+ var e = t[Symbol.toPrimitive];
343
+ if (void 0 !== e) {
344
+ var i = e.call(t, r || "default");
345
+ if ("object" != typeof i) return i;
346
+ throw new TypeError("@@toPrimitive must return a primitive value.");
347
+ }
348
+ return ("string" === r ? String : Number)(t);
349
+ }
350
+ function _toPropertyKey(t) {
351
+ var i = _toPrimitive(t, "string");
352
+ return "symbol" == typeof i ? i : i + "";
353
+ }
354
+ function _typeof(o) {
355
+ "@babel/helpers - typeof";
356
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
357
+ return typeof o;
358
+ } : function(o) {
359
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
360
+ }, _typeof(o);
361
+ }
362
+ function _unsupportedIterableToArray(r, a) {
363
+ if (r) {
364
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
365
+ var t = {}.toString.call(r).slice(8, -1);
366
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
367
+ }
368
+ }
369
+ var toRadians = function toRadians(deg) {
54
370
  return deg / 180 * Math.PI;
55
371
  };
56
- const toDegrees = function toDegrees(rad) {
372
+ var toDegrees = function toDegrees(rad) {
57
373
  return rad * (180 / Math.PI);
58
374
  };
59
- const solve = function(p1, p2) {
375
+ var solve = function solve(p1, p2) {
60
376
  var r = {
61
377
  c: 90,
62
378
  A: Math.abs(p2.x - p1.x),
@@ -68,7 +384,7 @@ function initJscadutils(_CSG, options = {}) {
68
384
  r.a = 90 - r.b;
69
385
  return r;
70
386
  };
71
- const solve90SA = function(r) {
387
+ var solve90SA = function solve90SA(r) {
72
388
  r = Object.assign(r, {
73
389
  C: 90
74
390
  });
@@ -80,7 +396,7 @@ function initJscadutils(_CSG, options = {}) {
80
396
  r.b = r.b || r.a / Math.tan(arad);
81
397
  return r;
82
398
  };
83
- const solve90ac = function(r) {
399
+ var solve90ac = function solve90ac(r) {
84
400
  r = Object.assign(r, {
85
401
  C: 90
86
402
  });
@@ -101,29 +417,29 @@ function initJscadutils(_CSG, options = {}) {
101
417
  }
102
418
  var triUtils = Object.freeze({
103
419
  __proto__: null,
420
+ toRadians,
421
+ toDegrees,
104
422
  solve,
105
423
  solve90SA,
106
424
  solve90ac,
107
- solveab,
108
- toDegrees,
109
- toRadians
425
+ solveab
110
426
  });
111
- const div$1 = function(a, f) {
427
+ var div$1 = function div(a, f) {
112
428
  return a.map(function(e) {
113
429
  return e / f;
114
430
  });
115
431
  };
116
- const addValue = function(a, f) {
432
+ var addValue = function addValue(a, f) {
117
433
  return a.map(function(e) {
118
434
  return e + f;
119
435
  });
120
436
  };
121
- const addArray = function(a, f) {
437
+ var addArray = function addArray(a, f) {
122
438
  return a.map(function(e, i) {
123
439
  return e + f[i];
124
440
  });
125
441
  };
126
- const add = function(a) {
442
+ var add = function add(a) {
127
443
  return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
128
444
  if (Array.isArray(arg)) {
129
445
  result = addArray(result, arg);
@@ -133,28 +449,28 @@ function initJscadutils(_CSG, options = {}) {
133
449
  return result;
134
450
  }, a);
135
451
  };
136
- const fromxyz = function(object) {
452
+ var fromxyz = function fromxyz(object) {
137
453
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
138
454
  };
139
- const toxyz = function(a) {
455
+ var toxyz = function toxyz(a) {
140
456
  return {
141
457
  x: a[0],
142
458
  y: a[1],
143
459
  z: a[2]
144
460
  };
145
461
  };
146
- const first = function(a) {
462
+ var first = function first(a) {
147
463
  return a ? a[0] : undefined;
148
464
  };
149
- const last = function(a) {
465
+ var last = function last(a) {
150
466
  return a && a.length > 0 ? a[a.length - 1] : undefined;
151
467
  };
152
- const min = function(a) {
468
+ var min = function min(a) {
153
469
  return a.reduce(function(result, value) {
154
470
  return value < result ? value : result;
155
471
  }, Number.MAX_VALUE);
156
472
  };
157
- const range = function(a, b) {
473
+ var range = function range(a, b) {
158
474
  var result = [];
159
475
  for (var i = a; i < b; i++) {
160
476
  result.push(i);
@@ -163,21 +479,21 @@ function initJscadutils(_CSG, options = {}) {
163
479
  };
164
480
  var array = Object.freeze({
165
481
  __proto__: null,
166
- add,
167
- addArray,
168
- addValue,
169
482
  div: div$1,
170
- first,
483
+ addValue,
484
+ addArray,
485
+ add,
171
486
  fromxyz,
487
+ toxyz,
488
+ first,
172
489
  last,
173
490
  min,
174
- range,
175
- toxyz
491
+ range
176
492
  });
177
- const debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
178
- 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" ];
493
+ var debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
494
+ 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" ];
179
495
  var debugCount = 0;
180
- const Debug = function(name) {
496
+ var Debug = function Debug(name) {
181
497
  var checks = Object.assign({
182
498
  enabled: [],
183
499
  disabled: [],
@@ -185,21 +501,31 @@ function initJscadutils(_CSG, options = {}) {
185
501
  browser: true
186
502
  }
187
503
  }, jscadUtilsDebug || {});
188
- var style = checks.options.browser ? `color:${debugColors[debugCount++ % debugColors.length]}` : `${termColors[debugCount++ % termColors.length]}`;
504
+ var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
189
505
  var enabled = checks.enabled.some(function checkEnabled(check) {
190
506
  return check.test(name);
191
507
  }) && !checks.disabled.some(function checkEnabled(check) {
192
508
  return check.test(name);
193
509
  });
194
- var logger = enabled ? checks.options.browser ? (...msg) => {
195
- console.log("%c%s", style, name, ...msg);
196
- } : (...msg) => {
197
- console.log(`${name}`, ...msg);
198
- } : () => undefined;
510
+ var logger = enabled ? checks.options.browser ? function() {
511
+ var _console;
512
+ for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
513
+ msg[_key] = arguments[_key];
514
+ }
515
+ (_console = console).log.apply(_console, [ "%c%s", style, name ].concat(msg));
516
+ } : function() {
517
+ var _console2;
518
+ for (var _len2 = arguments.length, msg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
519
+ msg[_key2] = arguments[_key2];
520
+ }
521
+ (_console2 = console).log.apply(_console2, [ "".concat(name) ].concat(msg));
522
+ } : function() {
523
+ return undefined;
524
+ };
199
525
  logger.enabled = enabled;
200
526
  return logger;
201
527
  };
202
- const nameArray = {
528
+ var nameArray = {
203
529
  aliceblue: "#f0f8ff",
204
530
  antiquewhite: "#faebd7",
205
531
  aqua: "#00ffff",
@@ -361,7 +687,7 @@ function initJscadutils(_CSG, options = {}) {
361
687
  return [ 0, 0, 0 ];
362
688
  }
363
689
  }
364
- const _name2rgb = {};
690
+ var _name2rgb = {};
365
691
  function name2rgb(n) {
366
692
  if (!_name2rgb[n]) _name2rgb[n] = hex2rgb(name2hex(n));
367
693
  return _name2rgb[n];
@@ -441,14 +767,23 @@ function initJscadutils(_CSG, options = {}) {
441
767
  proto.prototype.chamfer = function chamfer$1(radius, orientation, options) {
442
768
  return chamfer(this, radius, orientation, options);
443
769
  };
444
- proto.prototype.bisect = function bisect$1(...args) {
445
- return bisect(this, ...args);
770
+ proto.prototype.bisect = function bisect$1() {
771
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
772
+ args[_key] = arguments[_key];
773
+ }
774
+ return bisect.apply(util, [ this ].concat(args));
446
775
  };
447
- proto.prototype.slice = function slice$1(...args) {
448
- return slice(this, ...args);
776
+ proto.prototype.slice = function slice$1() {
777
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
778
+ args[_key2] = arguments[_key2];
779
+ }
780
+ return slice.apply(util, [ this ].concat(args));
449
781
  };
450
- proto.prototype.wedge = function wedge$1(...args) {
451
- return wedge(this, ...args);
782
+ proto.prototype.wedge = function wedge$1() {
783
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
784
+ args[_key3] = arguments[_key3];
785
+ }
786
+ return wedge.apply(util, [ this ].concat(args));
452
787
  };
453
788
  proto.prototype.stretch = function stretch$1(axis, distance, offset) {
454
789
  return stretch(this, axis, distance, offset);
@@ -465,7 +800,7 @@ function initJscadutils(_CSG, options = {}) {
465
800
  return this._translate(arguments[0]);
466
801
  } else {
467
802
  var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
468
- result = undefined.addArray(result, arg);
803
+ result = undefined(result, arg);
469
804
  return result;
470
805
  }, [ 0, 0, 0 ]);
471
806
  return this._translate(t);
@@ -474,10 +809,14 @@ function initJscadutils(_CSG, options = {}) {
474
809
  proto.prototype.addConnector = function addConnector$1(name, point, axis, normal) {
475
810
  return addConnector(this, name, point, axis, normal);
476
811
  };
477
- proto.prototype.connect = function connectTo(myConnectorName, otherConnector, mirror = false, normalrotation = 0) {
478
- var myConnector = myConnectorName.split(".").reduce((a, v) => a[v], this.properties);
812
+ proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
813
+ var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
814
+ var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
815
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
816
+ return a[v];
817
+ }, this.properties);
479
818
  if (!myConnector) {
480
- error(`The connector '${myConnectorName}' does not exist on the object [${Object.keys(this.properties).join(",")}]`, "Missing connector property");
819
+ error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
481
820
  }
482
821
  return this.connectTo(myConnector, otherConnector, mirror, normalrotation);
483
822
  };
@@ -487,13 +826,16 @@ function initJscadutils(_CSG, options = {}) {
487
826
  __proto__: null,
488
827
  default: init
489
828
  });
490
- const {CSG, CAG} = jsCadCSG;
491
- const {rectangular_extrude} = scadApi.extrusions;
492
- const {vector_text, vector_char} = scadApi.text;
493
- const {union} = scadApi.booleanOps;
829
+ var CSG = jsCadCSG__default["default"].CSG, CAG = jsCadCSG__default["default"].CAG;
830
+ var rectangular_extrude = scadApi__default["default"].extrusions.rectangular_extrude;
831
+ var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
832
+ var union = scadApi__default["default"].booleanOps.union;
494
833
  init(CSG);
495
- const debug$3 = Debug("jscadUtils:group");
496
- function JsCadUtilsGroup(names = [], parts = {}, holes = []) {
834
+ var debug$3 = Debug("jscadUtils:group");
835
+ function JsCadUtilsGroup() {
836
+ var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
837
+ var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
838
+ var holes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
497
839
  this.name = "";
498
840
  this.names = names;
499
841
  this.parts = parts;
@@ -521,7 +863,11 @@ function initJscadutils(_CSG, options = {}) {
521
863
  }
522
864
  return self;
523
865
  };
524
- JsCadUtilsGroup.prototype.combine = function(pieces, options = {}, map = x => x) {
866
+ JsCadUtilsGroup.prototype.combine = function(pieces) {
867
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
868
+ var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function(x) {
869
+ return x;
870
+ };
525
871
  try {
526
872
  var self = this;
527
873
  options = Object.assign({
@@ -529,7 +875,7 @@ function initJscadutils(_CSG, options = {}) {
529
875
  }, options);
530
876
  pieces = pieces ? pieces.split(",") : self.names;
531
877
  if (pieces.length === 0) {
532
- throw new Error(`no pieces found in ${self.name} pieces: ${pieces} parts: ${Object.keys(self.parts)} names: ${self.names}`);
878
+ throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
533
879
  }
534
880
  debug$3("combine", self.names, self.parts);
535
881
  var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
@@ -539,12 +885,14 @@ function initJscadutils(_CSG, options = {}) {
539
885
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
540
886
  } catch (err) {
541
887
  debug$3("combine error", this, pieces, options, err);
542
- 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");
888
+ 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");
543
889
  }
544
890
  };
545
891
  JsCadUtilsGroup.prototype.map = function(cb) {
546
892
  var self = this;
547
- self.parts = Object.keys(self.parts).filter(k => k !== "holes").reduce(function(result, key) {
893
+ self.parts = Object.keys(self.parts).filter(function(k) {
894
+ return k !== "holes";
895
+ }).reduce(function(result, key) {
548
896
  result[key] = cb(self.parts[key], key);
549
897
  return result;
550
898
  }, {});
@@ -560,7 +908,7 @@ function initJscadutils(_CSG, options = {}) {
560
908
  return self;
561
909
  };
562
910
  JsCadUtilsGroup.prototype.clone = function(name, map) {
563
- debug$3("clone", name, typeof name, map);
911
+ debug$3("clone", name, _typeof(name), map);
564
912
  var self = this;
565
913
  if (typeof name == "function") {
566
914
  map = name;
@@ -612,7 +960,7 @@ function initJscadutils(_CSG, options = {}) {
612
960
  return self;
613
961
  } catch (err) {
614
962
  debug$3("snap error", this, part, to, axis, delta, err);
615
- 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");
963
+ 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");
616
964
  }
617
965
  };
618
966
  JsCadUtilsGroup.prototype.align = function align(part, to, axis, delta) {
@@ -627,7 +975,7 @@ function initJscadutils(_CSG, options = {}) {
627
975
  return self;
628
976
  } catch (err) {
629
977
  debug$3("align error", this, part, to, axis, delta, err);
630
- 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");
978
+ 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");
631
979
  }
632
980
  };
633
981
  JsCadUtilsGroup.prototype.center = function center(part) {
@@ -639,7 +987,9 @@ function initJscadutils(_CSG, options = {}) {
639
987
  var bounds = self.parts[part].getBounds();
640
988
  return self.translate([ 0, 0, -bounds[0].z ]);
641
989
  };
642
- JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName, mirror = true, normalrotation = 0) {
990
+ JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
991
+ var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
992
+ var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
643
993
  debug$3("connectTo", {
644
994
  partName,
645
995
  connectorName,
@@ -649,9 +999,13 @@ function initJscadutils(_CSG, options = {}) {
649
999
  normalrotation
650
1000
  });
651
1001
  var self = this;
652
- var myConnector = connectorName.split(".").reduce((a, v) => a[v], self.parts[partName].properties);
1002
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1003
+ return a[v];
1004
+ }, self.parts[partName].properties);
653
1005
  debug$3("toConnector", to instanceof CSG.Connector);
654
- var toConnector = toConnectorName.split(".").reduce((a, v) => a[v], to.properties);
1006
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1007
+ return a[v];
1008
+ }, to.properties);
655
1009
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
656
1010
  debug$3("connectTo", matrix);
657
1011
  self.map(function(part) {
@@ -690,14 +1044,15 @@ function initJscadutils(_CSG, options = {}) {
690
1044
  return g;
691
1045
  };
692
1046
  JsCadUtilsGroup.prototype.array = function(parts, map) {
1047
+ var _this = this;
693
1048
  var self = this;
694
1049
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
695
1050
  if (!map) map = identity;
696
1051
  var a = [];
697
- p.forEach(name => {
1052
+ p.forEach(function(name) {
698
1053
  if (!self.parts[name]) {
699
- debug$3("array error", this, parts);
700
- throw error(`group::array error "${name}" not found.\nthis: ${this}\nparts: "${parts}"\n`, "JSCAD_UTILS_GROUP_ERROR");
1054
+ debug$3("array error", _this, parts);
1055
+ throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
701
1056
  }
702
1057
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
703
1058
  });
@@ -707,12 +1062,12 @@ function initJscadutils(_CSG, options = {}) {
707
1062
  var self = this;
708
1063
  var piecesArray = pieces ? pieces.split(",") : self.names;
709
1064
  return piecesArray.map(function(piece) {
710
- if (!self.parts[piece]) console.error(`Cannot find ${piece} in ${self.names}`);
1065
+ if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
711
1066
  return self.parts[piece];
712
1067
  });
713
1068
  };
714
1069
  JsCadUtilsGroup.prototype.toString = function() {
715
- 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}`;
1070
+ 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}");
716
1071
  };
717
1072
  JsCadUtilsGroup.prototype.setName = function(name) {
718
1073
  this.name = name;
@@ -742,7 +1097,9 @@ function initJscadutils(_CSG, options = {}) {
742
1097
  self.name = objectNames;
743
1098
  } else {
744
1099
  var objects = objectNames;
745
- self.names = Object.keys(objects).filter(k => k !== "holes");
1100
+ self.names = Object.keys(objects).filter(function(k) {
1101
+ return k !== "holes";
1102
+ });
746
1103
  self.parts = Object.assign({}, objects);
747
1104
  self.holes = objects.holes;
748
1105
  }
@@ -750,13 +1107,17 @@ function initJscadutils(_CSG, options = {}) {
750
1107
  }
751
1108
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
752
1109
  }
753
- const debug$2 = Debug("jscadUtils:util");
1110
+ var debug$2 = Debug("jscadUtils:util");
754
1111
  var NOZZEL_SIZE = .4;
755
- const nearest = {
756
- under: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1112
+ var nearest = {
1113
+ under: function under(desired) {
1114
+ var nozzel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NOZZEL_SIZE;
1115
+ var nozzie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
757
1116
  return (Math.floor(desired / nozzel) + nozzie) * nozzel;
758
1117
  },
759
- over: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1118
+ over: function over(desired) {
1119
+ var nozzel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NOZZEL_SIZE;
1120
+ var nozzie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
760
1121
  return (Math.ceil(desired / nozzel) + nozzie) * nozzel;
761
1122
  }
762
1123
  };
@@ -784,9 +1145,9 @@ function initJscadutils(_CSG, options = {}) {
784
1145
  debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
785
1146
  }
786
1147
  function jscadToString(o) {
787
- if (typeof o == "object") {
1148
+ if (_typeof(o) == "object") {
788
1149
  if (o.polygons) {
789
- return `{\npolygons: ${o.polygons.length},\nproperties: "${Object.keys(o.properties)}"\n}\n`;
1150
+ return "{\npolygons: ".concat(o.polygons.length, ',\nproperties: "').concat(Object.keys(o.properties), '"\n}\n');
790
1151
  }
791
1152
  } else {
792
1153
  return o.toString();
@@ -827,12 +1188,12 @@ function initJscadutils(_CSG, options = {}) {
827
1188
  }
828
1189
  function text(text) {
829
1190
  var l = vector_char(0, 0, text);
830
- var char = l.segments.reduce(function(result, segment) {
1191
+ var _char = l.segments.reduce(function(result, segment) {
831
1192
  var path = new CSG.Path2D(segment);
832
1193
  var cag = path.expandToCAG(2);
833
1194
  return result ? result.union(cag) : cag;
834
1195
  }, undefined);
835
- return char;
1196
+ return _char;
836
1197
  }
837
1198
  function unitCube(length, radius) {
838
1199
  radius = radius || .5;
@@ -888,7 +1249,7 @@ function initJscadutils(_CSG, options = {}) {
888
1249
  function mapPick(o, names, f, options) {
889
1250
  return names.reduce(function(result, name, index) {
890
1251
  if (!o[name]) {
891
- throw new Error(`${name} not found in ${options.name}: ${Object.keys(o).join(",")}`);
1252
+ throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
892
1253
  }
893
1254
  result.push(f ? f(o[name], name, index, o) : o[name]);
894
1255
  return result;
@@ -920,7 +1281,7 @@ function initJscadutils(_CSG, options = {}) {
920
1281
  function xyz2array(size) {
921
1282
  return [ size.x, size.y, size.z ];
922
1283
  }
923
- const rotationAxes = {
1284
+ var rotationAxes = {
924
1285
  x: [ 1, 0, 0 ],
925
1286
  y: [ 0, 1, 0 ],
926
1287
  z: [ 0, 0, 1 ]
@@ -998,7 +1359,7 @@ function initJscadutils(_CSG, options = {}) {
998
1359
  function mirrored4(x) {
999
1360
  return x.union([ x.mirroredY(90), x.mirroredX(90), x.mirroredY(90).mirroredX(90) ]);
1000
1361
  }
1001
- const flushSide = {
1362
+ var flushSide = {
1002
1363
  "above-outside": [ 1, 0 ],
1003
1364
  "above-inside": [ 1, 1 ],
1004
1365
  "below-outside": [ 0, 1 ],
@@ -1028,7 +1389,8 @@ function initJscadutils(_CSG, options = {}) {
1028
1389
  return w[side[0]][axis] - m[side[1]][axis];
1029
1390
  });
1030
1391
  }
1031
- function calcSnap(moveobj, withobj, axes, orientation, delta = 0) {
1392
+ function calcSnap(moveobj, withobj, axes, orientation) {
1393
+ var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1032
1394
  var side = flushSide[orientation];
1033
1395
  if (!side) {
1034
1396
  var fix = {
@@ -1094,7 +1456,7 @@ function initJscadutils(_CSG, options = {}) {
1094
1456
  objectSize = objectSize || size(bounds);
1095
1457
  return bounds[0].plus(objectSize.dividedBy(2));
1096
1458
  } catch (err) {
1097
- error(`centroid error o:${jscadToString(o)} objectSize: ${objectSize}`, undefined, err);
1459
+ error("centroid error o:".concat(jscadToString(o), " objectSize: ").concat(objectSize), undefined, err);
1098
1460
  }
1099
1461
  }
1100
1462
  function calcmidlineTo(o, axis, to) {
@@ -1115,7 +1477,8 @@ function initJscadutils(_CSG, options = {}) {
1115
1477
  });
1116
1478
  return t;
1117
1479
  }
1118
- function calcCenterWith(o, axes, withObj, delta = 0) {
1480
+ function calcCenterWith(o, axes, withObj) {
1481
+ var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1119
1482
  var objectCentroid = centroid(o);
1120
1483
  var withCentroid = centroid(withObj);
1121
1484
  var t = axisApply(axes, function(i, axis) {
@@ -1137,7 +1500,10 @@ function initJscadutils(_CSG, options = {}) {
1137
1500
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1138
1501
  });
1139
1502
  }
1140
- function bisect(...args) {
1503
+ function bisect() {
1504
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1505
+ args[_key] = arguments[_key];
1506
+ }
1141
1507
  if (args.length < 2) {
1142
1508
  error("bisect requires an object and an axis", "JSCAD_UTILS_INVALID_ARGS");
1143
1509
  }
@@ -1218,10 +1584,14 @@ function initJscadutils(_CSG, options = {}) {
1218
1584
  if (options.addRotationCenter) g.add(unitAxis(objectSize.length() + 10, .1, rotationCenter), "rotationCenter");
1219
1585
  return g;
1220
1586
  }
1221
- function slice(object, angle = 15, axis = "x", rotateaxis = "z", options = {
1222
- color: true,
1223
- addRotationCenter: true
1224
- }) {
1587
+ function slice(object) {
1588
+ var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;
1589
+ var axis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "x";
1590
+ var rotateaxis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "z";
1591
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
1592
+ color: true,
1593
+ addRotationCenter: true
1594
+ };
1225
1595
  var info = normalVector(axis);
1226
1596
  var rotationCenter = options.rotationCenter || new CSG.Vector3D(0, 0, 0);
1227
1597
  var theRotationAxis = rotationAxes[rotateaxis];
@@ -1438,11 +1808,12 @@ function initJscadutils(_CSG, options = {}) {
1438
1808
  };
1439
1809
  }
1440
1810
  function rotateAround(part, solid, axis, angle) {
1441
- var {rotationCenter, rotationAxis} = calcRotate(part, solid, axis);
1811
+ var _calcRotate = calcRotate(part, solid, axis), rotationCenter = _calcRotate.rotationCenter, rotationAxis = _calcRotate.rotationAxis;
1442
1812
  return part.rotate(rotationCenter, rotationAxis, angle);
1443
1813
  }
1444
- function cloneProperties(from, to, depth = 0) {
1445
- return Object.entries(from).reduce((props, [key, value]) => {
1814
+ function cloneProperties(from, to) {
1815
+ return Object.entries(from).reduce(function(props, _ref) {
1816
+ var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1446
1817
  props[key] = value;
1447
1818
  return props;
1448
1819
  }, to);
@@ -1453,85 +1824,14 @@ function initJscadutils(_CSG, options = {}) {
1453
1824
  debug$2("clone", o, c, CSG);
1454
1825
  return c;
1455
1826
  }
1456
- function addConnector(object, name, point = [ 0, 0, 0 ], axis = [ 1, 0, 0 ], normal = [ 0, 0, 1 ]) {
1827
+ function addConnector(object, name) {
1828
+ var point = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [ 0, 0, 0 ];
1829
+ var axis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [ 1, 0, 0 ];
1830
+ var normal = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [ 0, 0, 1 ];
1457
1831
  object.properties[name] = new CSG.Connector(point, axis, normal);
1458
1832
  return object;
1459
1833
  }
1460
- var util = Object.freeze({
1461
- __proto__: null,
1462
- NOZZEL_SIZE,
1463
- addConnector,
1464
- axis2array,
1465
- axisApply,
1466
- bisect,
1467
- calcCenterWith,
1468
- calcFlush,
1469
- calcRotate,
1470
- calcSnap,
1471
- calcmidlineTo,
1472
- center,
1473
- centerWith,
1474
- centerX,
1475
- centerY,
1476
- centroid,
1477
- chamfer,
1478
- clone,
1479
- cm,
1480
- defaults,
1481
- depreciated,
1482
- div,
1483
- divA,
1484
- divxyz,
1485
- enlarge,
1486
- error,
1487
- fillet,
1488
- fit,
1489
- flush,
1490
- flushSide,
1491
- getDelta,
1492
- identity,
1493
- ifArray,
1494
- inch,
1495
- isEmpty,
1496
- isNegative,
1497
- jscadToString,
1498
- label,
1499
- map,
1500
- mapPick,
1501
- mapValues,
1502
- midlineTo,
1503
- mirrored4,
1504
- mul,
1505
- mulxyz,
1506
- nearest,
1507
- normalVector,
1508
- pick,
1509
- poly2solid,
1510
- print,
1511
- reShape,
1512
- result,
1513
- rotateAround,
1514
- rotationAxes,
1515
- scale,
1516
- segment,
1517
- shift,
1518
- size,
1519
- slice,
1520
- sliceParams,
1521
- slices2poly,
1522
- snap,
1523
- stretch,
1524
- text,
1525
- toArray,
1526
- translator,
1527
- unitAxis,
1528
- unitCube,
1529
- wedge,
1530
- xyz2array,
1531
- zero,
1532
- zipObject
1533
- });
1534
- const debug$1 = Debug("jscadUtils:parts");
1834
+ var debug$1 = Debug("jscadUtils:parts");
1535
1835
  var parts = {
1536
1836
  BBox: BBox$1,
1537
1837
  Cube,
@@ -1539,13 +1839,16 @@ function initJscadutils(_CSG, options = {}) {
1539
1839
  Cylinder,
1540
1840
  Cone
1541
1841
  };
1542
- function BBox$1(...objects) {
1842
+ function BBox$1() {
1543
1843
  function box(object) {
1544
1844
  return CSG.cube({
1545
1845
  center: object.centroid(),
1546
1846
  radius: object.size().dividedBy(2)
1547
1847
  });
1548
1848
  }
1849
+ for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1850
+ objects[_key] = arguments[_key];
1851
+ }
1549
1852
  return objects.reduce(function(bbox, part) {
1550
1853
  var object = bbox ? union([ bbox, box(part) ]) : part;
1551
1854
  return box(object);
@@ -1578,7 +1881,8 @@ function initJscadutils(_CSG, options = {}) {
1578
1881
  });
1579
1882
  return roundedcube;
1580
1883
  }
1581
- function Cylinder(diameter, height, options = {}) {
1884
+ function Cylinder(diameter, height) {
1885
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1582
1886
  debug$1("parts.Cylinder", diameter, height, options);
1583
1887
  options = Object.assign({
1584
1888
  start: [ 0, 0, 0 ],
@@ -1588,7 +1892,8 @@ function initJscadutils(_CSG, options = {}) {
1588
1892
  }, options);
1589
1893
  return CSG.cylinder(options);
1590
1894
  }
1591
- function Cone(diameter1, diameter2, height, options = {}) {
1895
+ function Cone(diameter1, diameter2, height) {
1896
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1592
1897
  debug$1("parts.Cone", diameter1, diameter2, height, options);
1593
1898
  return CSG.cylinder(Object.assign({
1594
1899
  start: [ 0, 0, 0 ],
@@ -1617,7 +1922,9 @@ function initJscadutils(_CSG, options = {}) {
1617
1922
  function Tube(outsideDiameter, insideDiameter, height, outsideOptions, insideOptions) {
1618
1923
  return Cylinder(outsideDiameter, height, outsideOptions).subtract(Cylinder(insideDiameter, height, insideOptions || outsideOptions));
1619
1924
  }
1620
- function Anchor(width = 10, height = 10) {
1925
+ function Anchor() {
1926
+ var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
1927
+ var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
1621
1928
  var hole = Cylinder(width, height).Center().color("red");
1622
1929
  var post = Cylinder(height / 2, width * .66).rotateX(90).align(hole, "xz").snap(hole, "y", "inside-").translate([ 0, 0, -height / 6 ]).color("purple");
1623
1930
  return Group({
@@ -1637,7 +1944,7 @@ function initJscadutils(_CSG, options = {}) {
1637
1944
  });
1638
1945
  return board;
1639
1946
  }
1640
- const Hardware = {
1947
+ var Hardware = {
1641
1948
  Orientation: {
1642
1949
  up: {
1643
1950
  head: "outside-",
@@ -1648,7 +1955,7 @@ function initJscadutils(_CSG, options = {}) {
1648
1955
  clear: "inside-"
1649
1956
  }
1650
1957
  },
1651
- Screw: function(head, thread, headClearSpace, options) {
1958
+ Screw: function Screw(head, thread, headClearSpace, options) {
1652
1959
  depreciated("Screw", false, "Use the jscad-hardware screw methods instead");
1653
1960
  options = Object.assign(options, {
1654
1961
  orientation: "up",
@@ -1664,7 +1971,7 @@ function initJscadutils(_CSG, options = {}) {
1664
1971
  }
1665
1972
  return group;
1666
1973
  },
1667
- PanHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1974
+ PanHeadScrew: function PanHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1668
1975
  depreciated("PanHeadScrew", false, "Use the jscad-hardware screw methods instead");
1669
1976
  var head = Cylinder(headDiameter, headLength);
1670
1977
  var thread = Cylinder(diameter, length);
@@ -1673,7 +1980,7 @@ function initJscadutils(_CSG, options = {}) {
1673
1980
  }
1674
1981
  return Hardware.Screw(head, thread, headClearSpace, options);
1675
1982
  },
1676
- HexHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1983
+ HexHeadScrew: function HexHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1677
1984
  depreciated("HexHeadScrew", false, "Use the jscad-hardware screw methods instead");
1678
1985
  var head = Hexagon(headDiameter, headLength);
1679
1986
  var thread = Cylinder(diameter, length);
@@ -1682,7 +1989,7 @@ function initJscadutils(_CSG, options = {}) {
1682
1989
  }
1683
1990
  return Hardware.Screw(head, thread, headClearSpace, options);
1684
1991
  },
1685
- FlatHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1992
+ FlatHeadScrew: function FlatHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1686
1993
  depreciated("FlatHeadScrew", false, "Use the jscad-hardware screw methods instead");
1687
1994
  var head = Cone(headDiameter, diameter, headLength);
1688
1995
  var thread = Cylinder(diameter, length);
@@ -1694,20 +2001,20 @@ function initJscadutils(_CSG, options = {}) {
1694
2001
  };
1695
2002
  var parts$1 = Object.freeze({
1696
2003
  __proto__: null,
1697
- Anchor,
2004
+ default: parts,
1698
2005
  BBox: BBox$1,
1699
- Board,
1700
- Cone,
1701
2006
  Cube,
2007
+ RoundedCube,
1702
2008
  Cylinder,
1703
- Hardware,
2009
+ Cone,
1704
2010
  Hexagon,
1705
- RoundedCube,
1706
2011
  Triangle,
1707
2012
  Tube,
1708
- default: parts
2013
+ Anchor,
2014
+ Board,
2015
+ Hardware
1709
2016
  });
1710
- const debug = Debug("jscadUtils:boxes");
2017
+ var debug = Debug("jscadUtils:boxes");
1711
2018
  function RabbetJoin(box, thickness, cutHeight) {
1712
2019
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
1713
2020
  return rabbetJoin(box, thickness, cutHeight);
@@ -1720,16 +2027,17 @@ function initJscadutils(_CSG, options = {}) {
1720
2027
  var top = bottom.parts.positive.bisect("z", -thickness);
1721
2028
  return Group("top,middle,bottom", [ top.parts.positive, top.parts.negative.color("green"), bottom.parts.negative ]);
1722
2029
  }
1723
- function Rabett(box, thickness, gap, height, face, options = {}) {
2030
+ function Rabett(box, thickness, gap, height, face) {
2031
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
1724
2032
  debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
1725
2033
  gap = gap || .25;
1726
2034
  var inside = thickness - gap;
1727
2035
  var outside = -thickness + gap;
1728
2036
  debug("inside", inside, "outside", outside);
1729
2037
  var group = Group();
1730
- var {positive: top, negative: lower2_3rd} = box.bisect("z", height, options).parts;
2038
+ var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
1731
2039
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
1732
- var {positive: middle, negative: bottom} = lower2_3rd.bisect("z", lowerBisectHeight, options).parts;
2040
+ var _lower2_3rd$bisect$pa = lower2_3rd.bisect("z", lowerBisectHeight, options).parts, middle = _lower2_3rd$bisect$pa.positive, bottom = _lower2_3rd$bisect$pa.negative;
1733
2041
  var middleTop = middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]));
1734
2042
  group.add(top.union(middleTop), "top");
1735
2043
  var bottomOutline = middle.color("yellow").subtract(middle.color("orange").enlarge([ outside, outside, 0 ])).enlarge([ outside, outside, 0 ]);
@@ -1738,7 +2046,9 @@ function initJscadutils(_CSG, options = {}) {
1738
2046
  group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ])).subtract(middleTop)), "bottom");
1739
2047
  return group;
1740
2048
  }
1741
- const RabettTopBottom = function rabbetTMB(box, thickness, gap = .25, options = {}) {
2049
+ var RabettTopBottom = function rabbetTMB(box, thickness) {
2050
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
2051
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1742
2052
  options = Object.assign({
1743
2053
  removableTop: true,
1744
2054
  removableBottom: true,
@@ -1771,7 +2081,7 @@ function initJscadutils(_CSG, options = {}) {
1771
2081
  }
1772
2082
  return group;
1773
2083
  };
1774
- const CutOut = function cutOut(o, h, box, plug, gap) {
2084
+ var CutOut = function cutOut(o, h, box, plug, gap) {
1775
2085
  gap = gap || .25;
1776
2086
  var s = o.size();
1777
2087
  var cutout = o.intersect(box);
@@ -1789,7 +2099,7 @@ function initJscadutils(_CSG, options = {}) {
1789
2099
  insert: union([ o, top ]).intersect(box).subtract(o).enlarge([ -gap, 0, 0 ]).union(clip.subtract(plug).enlarge(-gap, -gap, 0)).color("blue")
1790
2100
  });
1791
2101
  };
1792
- const Rectangle = function(size, thickness, cb) {
2102
+ var Rectangle = function Rectangle(size, thickness, cb) {
1793
2103
  thickness = thickness || 2;
1794
2104
  var s = div$1(xyz2array(size), 2);
1795
2105
  var r = add(s, thickness);
@@ -1803,7 +2113,7 @@ function initJscadutils(_CSG, options = {}) {
1803
2113
  if (cb) box = cb(box);
1804
2114
  return box;
1805
2115
  };
1806
- const Hollow = function(object, thickness, interiorcb, exteriorcb) {
2116
+ var Hollow = function Hollow(object, thickness, interiorcb, exteriorcb) {
1807
2117
  thickness = thickness || 2;
1808
2118
  var size = -thickness * 2;
1809
2119
  interiorcb = interiorcb || identity;
@@ -1811,7 +2121,7 @@ function initJscadutils(_CSG, options = {}) {
1811
2121
  if (exteriorcb) box = exteriorcb(box);
1812
2122
  return box;
1813
2123
  };
1814
- const BBox = function(o) {
2124
+ var BBox = function BBox(o) {
1815
2125
  depreciated("BBox", true, "Use 'parts.BBox' instead");
1816
2126
  var s = div$1(xyz2array(o.size()), 2);
1817
2127
  return CSG.cube({
@@ -1822,7 +2132,8 @@ function initJscadutils(_CSG, options = {}) {
1822
2132
  function getRadius(o) {
1823
2133
  return div$1(xyz2array(o.size()), 2);
1824
2134
  }
1825
- function rabbetJoin(box, thickness, gap = .25) {
2135
+ function rabbetJoin(box, thickness) {
2136
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
1826
2137
  var r = add(getRadius(box), -thickness / 2);
1827
2138
  r[2] = thickness / 2;
1828
2139
  var cutter = CSG.cube({
@@ -1840,17 +2151,16 @@ function initJscadutils(_CSG, options = {}) {
1840
2151
  }
1841
2152
  var Boxes = Object.freeze({
1842
2153
  __proto__: null,
1843
- BBox,
1844
- CutOut,
1845
- Hollow,
1846
2154
  RabbetJoin,
2155
+ topMiddleBottom,
1847
2156
  Rabett,
1848
2157
  RabettTopBottom,
2158
+ CutOut,
1849
2159
  Rectangle,
1850
- topMiddleBottom
2160
+ Hollow,
2161
+ BBox
1851
2162
  });
1852
- const compatV1 = {
1853
- ...util,
2163
+ var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
1854
2164
  group: Group,
1855
2165
  init: init$1,
1856
2166
  triangle: triUtils,
@@ -1858,7 +2168,7 @@ function initJscadutils(_CSG, options = {}) {
1858
2168
  parts: parts$1,
1859
2169
  Boxes,
1860
2170
  Debug
1861
- };
2171
+ });
1862
2172
  exports.Boxes = Boxes;
1863
2173
  exports.Debug = Debug;
1864
2174
  exports.Group = Group;
@@ -1868,6 +2178,9 @@ function initJscadutils(_CSG, options = {}) {
1868
2178
  exports.parts = parts$1;
1869
2179
  exports.triUtils = triUtils;
1870
2180
  exports.util = util;
2181
+ Object.defineProperty(exports, "__esModule", {
2182
+ value: true
2183
+ });
1871
2184
  return exports;
1872
2185
  }({}, jsCadCSG, scadApi);
1873
2186
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
@@ -1885,7 +2198,7 @@ function initJscadutils(_CSG, options = {}) {
1885
2198
 
1886
2199
  var jscadUtilsPluginInit = [];
1887
2200
 
1888
- util = {
2201
+ var util = {
1889
2202
  init: (...a) => {
1890
2203
  initJscadutils(...a);
1891
2204
  jscadUtilsPluginInit.forEach(p => {