@jwc/jscad-utils 5.0.2 → 5.2.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.
@@ -62,13 +62,329 @@ function initJscadutils(_CSG, options = {}) {
62
62
  });
63
63
  var jscadUtils = function(exports, jsCadCSG, scadApi) {
64
64
  "use strict";
65
- const toRadians = function toRadians(deg) {
65
+ function _interopDefaultLegacy(e) {
66
+ return e && typeof e === "object" && "default" in e ? e : {
67
+ default: e
68
+ };
69
+ }
70
+ var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
71
+ var scadApi__default = _interopDefaultLegacy(scadApi);
72
+ var util = Object.freeze({
73
+ __proto__: null,
74
+ get NOZZEL_SIZE() {
75
+ return NOZZEL_SIZE;
76
+ },
77
+ get nearest() {
78
+ return nearest;
79
+ },
80
+ get identity() {
81
+ return identity;
82
+ },
83
+ get result() {
84
+ return result;
85
+ },
86
+ get defaults() {
87
+ return defaults;
88
+ },
89
+ get isEmpty() {
90
+ return isEmpty;
91
+ },
92
+ get isNegative() {
93
+ return isNegative;
94
+ },
95
+ get print() {
96
+ return print;
97
+ },
98
+ get jscadToString() {
99
+ return jscadToString;
100
+ },
101
+ get error() {
102
+ return error;
103
+ },
104
+ get depreciated() {
105
+ return depreciated;
106
+ },
107
+ get inch() {
108
+ return inch;
109
+ },
110
+ get cm() {
111
+ return cm;
112
+ },
113
+ get label() {
114
+ return label;
115
+ },
116
+ get text() {
117
+ return text;
118
+ },
119
+ get unitCube() {
120
+ return unitCube;
121
+ },
122
+ get unitAxis() {
123
+ return unitAxis;
124
+ },
125
+ get toArray() {
126
+ return toArray;
127
+ },
128
+ get ifArray() {
129
+ return ifArray;
130
+ },
131
+ get segment() {
132
+ return segment;
133
+ },
134
+ get zipObject() {
135
+ return zipObject;
136
+ },
137
+ get map() {
138
+ return map;
139
+ },
140
+ get mapValues() {
141
+ return mapValues;
142
+ },
143
+ get pick() {
144
+ return pick;
145
+ },
146
+ get mapPick() {
147
+ return mapPick;
148
+ },
149
+ get divA() {
150
+ return divA;
151
+ },
152
+ get divxyz() {
153
+ return divxyz;
154
+ },
155
+ get div() {
156
+ return div;
157
+ },
158
+ get mulxyz() {
159
+ return mulxyz;
160
+ },
161
+ get mul() {
162
+ return mul;
163
+ },
164
+ get xyz2array() {
165
+ return xyz2array;
166
+ },
167
+ get rotationAxes() {
168
+ return rotationAxes;
169
+ },
170
+ get size() {
171
+ return size;
172
+ },
173
+ get scale() {
174
+ return scale;
175
+ },
176
+ get center() {
177
+ return center;
178
+ },
179
+ get centerY() {
180
+ return centerY;
181
+ },
182
+ get centerX() {
183
+ return centerX;
184
+ },
185
+ get enlarge() {
186
+ return enlarge;
187
+ },
188
+ get fit() {
189
+ return fit;
190
+ },
191
+ get shift() {
192
+ return shift;
193
+ },
194
+ get zero() {
195
+ return zero;
196
+ },
197
+ get mirrored4() {
198
+ return mirrored4;
199
+ },
200
+ get flushSide() {
201
+ return flushSide;
202
+ },
203
+ get calcFlush() {
204
+ return calcFlush;
205
+ },
206
+ get calcSnap() {
207
+ return calcSnap;
208
+ },
209
+ get snap() {
210
+ return snap;
211
+ },
212
+ get flush() {
213
+ return flush;
214
+ },
215
+ get axisApply() {
216
+ return axisApply;
217
+ },
218
+ get axis2array() {
219
+ return axis2array;
220
+ },
221
+ get centroid() {
222
+ return centroid;
223
+ },
224
+ get calcmidlineTo() {
225
+ return calcmidlineTo;
226
+ },
227
+ get midlineTo() {
228
+ return midlineTo;
229
+ },
230
+ get translator() {
231
+ return translator;
232
+ },
233
+ get calcCenterWith() {
234
+ return calcCenterWith;
235
+ },
236
+ get centerWith() {
237
+ return centerWith;
238
+ },
239
+ get getDelta() {
240
+ return getDelta;
241
+ },
242
+ get bisect() {
243
+ return bisect;
244
+ },
245
+ get slice() {
246
+ return slice;
247
+ },
248
+ get wedge() {
249
+ return wedge;
250
+ },
251
+ get stretch() {
252
+ return stretch;
253
+ },
254
+ get poly2solid() {
255
+ return poly2solid;
256
+ },
257
+ get slices2poly() {
258
+ return slices2poly;
259
+ },
260
+ get normalVector() {
261
+ return normalVector;
262
+ },
263
+ get sliceParams() {
264
+ return sliceParams;
265
+ },
266
+ get reShape() {
267
+ return reShape;
268
+ },
269
+ get chamfer() {
270
+ return chamfer;
271
+ },
272
+ get fillet() {
273
+ return fillet;
274
+ },
275
+ get calcRotate() {
276
+ return calcRotate;
277
+ },
278
+ get rotateAround() {
279
+ return rotateAround;
280
+ },
281
+ get clone() {
282
+ return clone;
283
+ },
284
+ get addConnector() {
285
+ return addConnector;
286
+ }
287
+ });
288
+ function _arrayLikeToArray(r, a) {
289
+ (null == a || a > r.length) && (a = r.length);
290
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
291
+ return n;
292
+ }
293
+ function _arrayWithHoles(r) {
294
+ if (Array.isArray(r)) return r;
295
+ }
296
+ function _defineProperty(e, r, t) {
297
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
298
+ value: t,
299
+ enumerable: !0,
300
+ configurable: !0,
301
+ writable: !0
302
+ }) : e[r] = t, e;
303
+ }
304
+ function _iterableToArrayLimit(r, l) {
305
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
306
+ if (null != t) {
307
+ var e, n, i, u, a = [], f = !0, o = !1;
308
+ try {
309
+ if (i = (t = t.call(r)).next, 0 === l) {
310
+ if (Object(t) !== t) return;
311
+ f = !1;
312
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
313
+ } catch (r) {
314
+ o = !0, n = r;
315
+ } finally {
316
+ try {
317
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
318
+ } finally {
319
+ if (o) throw n;
320
+ }
321
+ }
322
+ return a;
323
+ }
324
+ }
325
+ function _nonIterableRest() {
326
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
327
+ }
328
+ function ownKeys(e, r) {
329
+ var t = Object.keys(e);
330
+ if (Object.getOwnPropertySymbols) {
331
+ var o = Object.getOwnPropertySymbols(e);
332
+ r && (o = o.filter(function(r) {
333
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
334
+ })), t.push.apply(t, o);
335
+ }
336
+ return t;
337
+ }
338
+ function _objectSpread2(e) {
339
+ for (var r = 1; r < arguments.length; r++) {
340
+ var t = null != arguments[r] ? arguments[r] : {};
341
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
342
+ _defineProperty(e, r, t[r]);
343
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
344
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
345
+ });
346
+ }
347
+ return e;
348
+ }
349
+ function _slicedToArray(r, e) {
350
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
351
+ }
352
+ function _toPrimitive(t, r) {
353
+ if ("object" != typeof t || !t) return t;
354
+ var e = t[Symbol.toPrimitive];
355
+ if (void 0 !== e) {
356
+ var i = e.call(t, r || "default");
357
+ if ("object" != typeof i) return i;
358
+ throw new TypeError("@@toPrimitive must return a primitive value.");
359
+ }
360
+ return ("string" === r ? String : Number)(t);
361
+ }
362
+ function _toPropertyKey(t) {
363
+ var i = _toPrimitive(t, "string");
364
+ return "symbol" == typeof i ? i : i + "";
365
+ }
366
+ function _typeof(o) {
367
+ "@babel/helpers - typeof";
368
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
369
+ return typeof o;
370
+ } : function(o) {
371
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
372
+ }, _typeof(o);
373
+ }
374
+ function _unsupportedIterableToArray(r, a) {
375
+ if (r) {
376
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
377
+ var t = {}.toString.call(r).slice(8, -1);
378
+ 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;
379
+ }
380
+ }
381
+ var toRadians = function toRadians(deg) {
66
382
  return deg / 180 * Math.PI;
67
383
  };
68
- const toDegrees = function toDegrees(rad) {
384
+ var toDegrees = function toDegrees(rad) {
69
385
  return rad * (180 / Math.PI);
70
386
  };
71
- const solve = function(p1, p2) {
387
+ var solve = function solve(p1, p2) {
72
388
  var r = {
73
389
  c: 90,
74
390
  A: Math.abs(p2.x - p1.x),
@@ -80,7 +396,7 @@ function initJscadutils(_CSG, options = {}) {
80
396
  r.a = 90 - r.b;
81
397
  return r;
82
398
  };
83
- const solve90SA = function(r) {
399
+ var solve90SA = function solve90SA(r) {
84
400
  r = Object.assign(r, {
85
401
  C: 90
86
402
  });
@@ -92,7 +408,7 @@ function initJscadutils(_CSG, options = {}) {
92
408
  r.b = r.b || r.a / Math.tan(arad);
93
409
  return r;
94
410
  };
95
- const solve90ac = function(r) {
411
+ var solve90ac = function solve90ac(r) {
96
412
  r = Object.assign(r, {
97
413
  C: 90
98
414
  });
@@ -113,29 +429,29 @@ function initJscadutils(_CSG, options = {}) {
113
429
  }
114
430
  var triUtils = Object.freeze({
115
431
  __proto__: null,
432
+ toRadians,
433
+ toDegrees,
116
434
  solve,
117
435
  solve90SA,
118
436
  solve90ac,
119
- solveab,
120
- toDegrees,
121
- toRadians
437
+ solveab
122
438
  });
123
- const div$1 = function(a, f) {
439
+ var div$1 = function div(a, f) {
124
440
  return a.map(function(e) {
125
441
  return e / f;
126
442
  });
127
443
  };
128
- const addValue = function(a, f) {
444
+ var addValue = function addValue(a, f) {
129
445
  return a.map(function(e) {
130
446
  return e + f;
131
447
  });
132
448
  };
133
- const addArray = function(a, f) {
449
+ var addArray = function addArray(a, f) {
134
450
  return a.map(function(e, i) {
135
451
  return e + f[i];
136
452
  });
137
453
  };
138
- const add = function(a) {
454
+ var add = function add(a) {
139
455
  return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
140
456
  if (Array.isArray(arg)) {
141
457
  result = addArray(result, arg);
@@ -145,28 +461,28 @@ function initJscadutils(_CSG, options = {}) {
145
461
  return result;
146
462
  }, a);
147
463
  };
148
- const fromxyz = function(object) {
464
+ var fromxyz = function fromxyz(object) {
149
465
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
150
466
  };
151
- const toxyz = function(a) {
467
+ var toxyz = function toxyz(a) {
152
468
  return {
153
469
  x: a[0],
154
470
  y: a[1],
155
471
  z: a[2]
156
472
  };
157
473
  };
158
- const first = function(a) {
474
+ var first = function first(a) {
159
475
  return a ? a[0] : undefined;
160
476
  };
161
- const last = function(a) {
477
+ var last = function last(a) {
162
478
  return a && a.length > 0 ? a[a.length - 1] : undefined;
163
479
  };
164
- const min = function(a) {
480
+ var min = function min(a) {
165
481
  return a.reduce(function(result, value) {
166
482
  return value < result ? value : result;
167
483
  }, Number.MAX_VALUE);
168
484
  };
169
- const range = function(a, b) {
485
+ var range = function range(a, b) {
170
486
  var result = [];
171
487
  for (var i = a; i < b; i++) {
172
488
  result.push(i);
@@ -175,21 +491,21 @@ function initJscadutils(_CSG, options = {}) {
175
491
  };
176
492
  var array = Object.freeze({
177
493
  __proto__: null,
178
- add,
179
- addArray,
180
- addValue,
181
494
  div: div$1,
182
- first,
495
+ addValue,
496
+ addArray,
497
+ add,
183
498
  fromxyz,
499
+ toxyz,
500
+ first,
184
501
  last,
185
502
  min,
186
- range,
187
- toxyz
503
+ range
188
504
  });
189
- const debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
190
- 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" ];
505
+ var debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
506
+ 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" ];
191
507
  var debugCount = 0;
192
- const Debug = function(name) {
508
+ var Debug = function Debug(name) {
193
509
  var checks = Object.assign({
194
510
  enabled: [],
195
511
  disabled: [],
@@ -197,21 +513,31 @@ function initJscadutils(_CSG, options = {}) {
197
513
  browser: true
198
514
  }
199
515
  }, jscadUtilsDebug || {});
200
- var style = checks.options.browser ? `color:${debugColors[debugCount++ % debugColors.length]}` : `${termColors[debugCount++ % termColors.length]}`;
516
+ var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
201
517
  var enabled = checks.enabled.some(function checkEnabled(check) {
202
518
  return check.test(name);
203
519
  }) && !checks.disabled.some(function checkEnabled(check) {
204
520
  return check.test(name);
205
521
  });
206
- var logger = enabled ? checks.options.browser ? (...msg) => {
207
- console.log("%c%s", style, name, ...msg);
208
- } : (...msg) => {
209
- console.log(`${name}`, ...msg);
210
- } : () => undefined;
522
+ var logger = enabled ? checks.options.browser ? function() {
523
+ var _console;
524
+ for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
525
+ msg[_key] = arguments[_key];
526
+ }
527
+ (_console = console).log.apply(_console, [ "%c%s", style, name ].concat(msg));
528
+ } : function() {
529
+ var _console2;
530
+ for (var _len2 = arguments.length, msg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
531
+ msg[_key2] = arguments[_key2];
532
+ }
533
+ (_console2 = console).log.apply(_console2, [ "".concat(name) ].concat(msg));
534
+ } : function() {
535
+ return undefined;
536
+ };
211
537
  logger.enabled = enabled;
212
538
  return logger;
213
539
  };
214
- const nameArray = {
540
+ var nameArray = {
215
541
  aliceblue: "#f0f8ff",
216
542
  antiquewhite: "#faebd7",
217
543
  aqua: "#00ffff",
@@ -373,7 +699,7 @@ function initJscadutils(_CSG, options = {}) {
373
699
  return [ 0, 0, 0 ];
374
700
  }
375
701
  }
376
- const _name2rgb = {};
702
+ var _name2rgb = {};
377
703
  function name2rgb(n) {
378
704
  if (!_name2rgb[n]) _name2rgb[n] = hex2rgb(name2hex(n));
379
705
  return _name2rgb[n];
@@ -453,14 +779,23 @@ function initJscadutils(_CSG, options = {}) {
453
779
  proto.prototype.chamfer = function chamfer$1(radius, orientation, options) {
454
780
  return chamfer(this, radius, orientation, options);
455
781
  };
456
- proto.prototype.bisect = function bisect$1(...args) {
457
- return bisect(this, ...args);
782
+ proto.prototype.bisect = function bisect$1() {
783
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
784
+ args[_key] = arguments[_key];
785
+ }
786
+ return bisect.apply(util, [ this ].concat(args));
458
787
  };
459
- proto.prototype.slice = function slice$1(...args) {
460
- return slice(this, ...args);
788
+ proto.prototype.slice = function slice$1() {
789
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
790
+ args[_key2] = arguments[_key2];
791
+ }
792
+ return slice.apply(util, [ this ].concat(args));
461
793
  };
462
- proto.prototype.wedge = function wedge$1(...args) {
463
- return wedge(this, ...args);
794
+ proto.prototype.wedge = function wedge$1() {
795
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
796
+ args[_key3] = arguments[_key3];
797
+ }
798
+ return wedge.apply(util, [ this ].concat(args));
464
799
  };
465
800
  proto.prototype.stretch = function stretch$1(axis, distance, offset) {
466
801
  return stretch(this, axis, distance, offset);
@@ -477,7 +812,7 @@ function initJscadutils(_CSG, options = {}) {
477
812
  return this._translate(arguments[0]);
478
813
  } else {
479
814
  var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
480
- result = undefined.addArray(result, arg);
815
+ result = undefined(result, arg);
481
816
  return result;
482
817
  }, [ 0, 0, 0 ]);
483
818
  return this._translate(t);
@@ -486,10 +821,14 @@ function initJscadutils(_CSG, options = {}) {
486
821
  proto.prototype.addConnector = function addConnector$1(name, point, axis, normal) {
487
822
  return addConnector(this, name, point, axis, normal);
488
823
  };
489
- proto.prototype.connect = function connectTo(myConnectorName, otherConnector, mirror = false, normalrotation = 0) {
490
- var myConnector = myConnectorName.split(".").reduce((a, v) => a[v], this.properties);
824
+ proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
825
+ var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
826
+ var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
827
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
828
+ return a[v];
829
+ }, this.properties);
491
830
  if (!myConnector) {
492
- error(`The connector '${myConnectorName}' does not exist on the object [${Object.keys(this.properties).join(",")}]`, "Missing connector property");
831
+ error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
493
832
  }
494
833
  return this.connectTo(myConnector, otherConnector, mirror, normalrotation);
495
834
  };
@@ -499,13 +838,16 @@ function initJscadutils(_CSG, options = {}) {
499
838
  __proto__: null,
500
839
  default: init
501
840
  });
502
- const {CSG, CAG} = jsCadCSG;
503
- const {rectangular_extrude} = scadApi.extrusions;
504
- const {vector_text, vector_char} = scadApi.text;
505
- const {union} = scadApi.booleanOps;
841
+ var CSG = jsCadCSG__default["default"].CSG, CAG = jsCadCSG__default["default"].CAG;
842
+ var rectangular_extrude = scadApi__default["default"].extrusions.rectangular_extrude;
843
+ var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
844
+ var union = scadApi__default["default"].booleanOps.union;
506
845
  init(CSG);
507
- const debug$3 = Debug("jscadUtils:group");
508
- function JsCadUtilsGroup(names = [], parts = {}, holes = []) {
846
+ var debug$3 = Debug("jscadUtils:group");
847
+ function JsCadUtilsGroup() {
848
+ var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
849
+ var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
850
+ var holes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
509
851
  this.name = "";
510
852
  this.names = names;
511
853
  this.parts = parts;
@@ -533,7 +875,11 @@ function initJscadutils(_CSG, options = {}) {
533
875
  }
534
876
  return self;
535
877
  };
536
- JsCadUtilsGroup.prototype.combine = function(pieces, options = {}, map = x => x) {
878
+ JsCadUtilsGroup.prototype.combine = function(pieces) {
879
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
880
+ var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function(x) {
881
+ return x;
882
+ };
537
883
  try {
538
884
  var self = this;
539
885
  options = Object.assign({
@@ -541,7 +887,7 @@ function initJscadutils(_CSG, options = {}) {
541
887
  }, options);
542
888
  pieces = pieces ? pieces.split(",") : self.names;
543
889
  if (pieces.length === 0) {
544
- throw new Error(`no pieces found in ${self.name} pieces: ${pieces} parts: ${Object.keys(self.parts)} names: ${self.names}`);
890
+ throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
545
891
  }
546
892
  debug$3("combine", self.names, self.parts);
547
893
  var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
@@ -551,12 +897,14 @@ function initJscadutils(_CSG, options = {}) {
551
897
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
552
898
  } catch (err) {
553
899
  debug$3("combine error", this, pieces, options, err);
554
- 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");
900
+ 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");
555
901
  }
556
902
  };
557
903
  JsCadUtilsGroup.prototype.map = function(cb) {
558
904
  var self = this;
559
- self.parts = Object.keys(self.parts).filter(k => k !== "holes").reduce(function(result, key) {
905
+ self.parts = Object.keys(self.parts).filter(function(k) {
906
+ return k !== "holes";
907
+ }).reduce(function(result, key) {
560
908
  result[key] = cb(self.parts[key], key);
561
909
  return result;
562
910
  }, {});
@@ -572,7 +920,7 @@ function initJscadutils(_CSG, options = {}) {
572
920
  return self;
573
921
  };
574
922
  JsCadUtilsGroup.prototype.clone = function(name, map) {
575
- debug$3("clone", name, typeof name, map);
923
+ debug$3("clone", name, _typeof(name), map);
576
924
  var self = this;
577
925
  if (typeof name == "function") {
578
926
  map = name;
@@ -624,7 +972,7 @@ function initJscadutils(_CSG, options = {}) {
624
972
  return self;
625
973
  } catch (err) {
626
974
  debug$3("snap error", this, part, to, axis, delta, err);
627
- 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");
975
+ 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");
628
976
  }
629
977
  };
630
978
  JsCadUtilsGroup.prototype.align = function align(part, to, axis, delta) {
@@ -639,7 +987,7 @@ function initJscadutils(_CSG, options = {}) {
639
987
  return self;
640
988
  } catch (err) {
641
989
  debug$3("align error", this, part, to, axis, delta, err);
642
- 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");
990
+ 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");
643
991
  }
644
992
  };
645
993
  JsCadUtilsGroup.prototype.center = function center(part) {
@@ -651,7 +999,9 @@ function initJscadutils(_CSG, options = {}) {
651
999
  var bounds = self.parts[part].getBounds();
652
1000
  return self.translate([ 0, 0, -bounds[0].z ]);
653
1001
  };
654
- JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName, mirror = true, normalrotation = 0) {
1002
+ JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
1003
+ var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1004
+ var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
655
1005
  debug$3("connectTo", {
656
1006
  partName,
657
1007
  connectorName,
@@ -661,9 +1011,13 @@ function initJscadutils(_CSG, options = {}) {
661
1011
  normalrotation
662
1012
  });
663
1013
  var self = this;
664
- var myConnector = connectorName.split(".").reduce((a, v) => a[v], self.parts[partName].properties);
1014
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1015
+ return a[v];
1016
+ }, self.parts[partName].properties);
665
1017
  debug$3("toConnector", to instanceof CSG.Connector);
666
- var toConnector = toConnectorName.split(".").reduce((a, v) => a[v], to.properties);
1018
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1019
+ return a[v];
1020
+ }, to.properties);
667
1021
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
668
1022
  debug$3("connectTo", matrix);
669
1023
  self.map(function(part) {
@@ -702,14 +1056,15 @@ function initJscadutils(_CSG, options = {}) {
702
1056
  return g;
703
1057
  };
704
1058
  JsCadUtilsGroup.prototype.array = function(parts, map) {
1059
+ var _this = this;
705
1060
  var self = this;
706
1061
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
707
1062
  if (!map) map = identity;
708
1063
  var a = [];
709
- p.forEach(name => {
1064
+ p.forEach(function(name) {
710
1065
  if (!self.parts[name]) {
711
- debug$3("array error", this, parts);
712
- throw error(`group::array error "${name}" not found.\nthis: ${this}\nparts: "${parts}"\n`, "JSCAD_UTILS_GROUP_ERROR");
1066
+ debug$3("array error", _this, parts);
1067
+ throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
713
1068
  }
714
1069
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
715
1070
  });
@@ -719,12 +1074,12 @@ function initJscadutils(_CSG, options = {}) {
719
1074
  var self = this;
720
1075
  var piecesArray = pieces ? pieces.split(",") : self.names;
721
1076
  return piecesArray.map(function(piece) {
722
- if (!self.parts[piece]) console.error(`Cannot find ${piece} in ${self.names}`);
1077
+ if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
723
1078
  return self.parts[piece];
724
1079
  });
725
1080
  };
726
1081
  JsCadUtilsGroup.prototype.toString = function() {
727
- 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}`;
1082
+ 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}");
728
1083
  };
729
1084
  JsCadUtilsGroup.prototype.setName = function(name) {
730
1085
  this.name = name;
@@ -754,7 +1109,9 @@ function initJscadutils(_CSG, options = {}) {
754
1109
  self.name = objectNames;
755
1110
  } else {
756
1111
  var objects = objectNames;
757
- self.names = Object.keys(objects).filter(k => k !== "holes");
1112
+ self.names = Object.keys(objects).filter(function(k) {
1113
+ return k !== "holes";
1114
+ });
758
1115
  self.parts = Object.assign({}, objects);
759
1116
  self.holes = objects.holes;
760
1117
  }
@@ -762,13 +1119,17 @@ function initJscadutils(_CSG, options = {}) {
762
1119
  }
763
1120
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
764
1121
  }
765
- const debug$2 = Debug("jscadUtils:util");
1122
+ var debug$2 = Debug("jscadUtils:util");
766
1123
  var NOZZEL_SIZE = .4;
767
- const nearest = {
768
- under: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1124
+ var nearest = {
1125
+ under: function under(desired) {
1126
+ var nozzel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NOZZEL_SIZE;
1127
+ var nozzie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
769
1128
  return (Math.floor(desired / nozzel) + nozzie) * nozzel;
770
1129
  },
771
- over: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1130
+ over: function over(desired) {
1131
+ var nozzel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NOZZEL_SIZE;
1132
+ var nozzie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
772
1133
  return (Math.ceil(desired / nozzel) + nozzie) * nozzel;
773
1134
  }
774
1135
  };
@@ -796,9 +1157,9 @@ function initJscadutils(_CSG, options = {}) {
796
1157
  debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
797
1158
  }
798
1159
  function jscadToString(o) {
799
- if (typeof o == "object") {
1160
+ if (_typeof(o) == "object") {
800
1161
  if (o.polygons) {
801
- return `{\npolygons: ${o.polygons.length},\nproperties: "${Object.keys(o.properties)}"\n}\n`;
1162
+ return "{\npolygons: ".concat(o.polygons.length, ',\nproperties: "').concat(Object.keys(o.properties), '"\n}\n');
802
1163
  }
803
1164
  } else {
804
1165
  return o.toString();
@@ -839,12 +1200,12 @@ function initJscadutils(_CSG, options = {}) {
839
1200
  }
840
1201
  function text(text) {
841
1202
  var l = vector_char(0, 0, text);
842
- var char = l.segments.reduce(function(result, segment) {
1203
+ var _char = l.segments.reduce(function(result, segment) {
843
1204
  var path = new CSG.Path2D(segment);
844
1205
  var cag = path.expandToCAG(2);
845
1206
  return result ? result.union(cag) : cag;
846
1207
  }, undefined);
847
- return char;
1208
+ return _char;
848
1209
  }
849
1210
  function unitCube(length, radius) {
850
1211
  radius = radius || .5;
@@ -900,7 +1261,7 @@ function initJscadutils(_CSG, options = {}) {
900
1261
  function mapPick(o, names, f, options) {
901
1262
  return names.reduce(function(result, name, index) {
902
1263
  if (!o[name]) {
903
- throw new Error(`${name} not found in ${options.name}: ${Object.keys(o).join(",")}`);
1264
+ throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
904
1265
  }
905
1266
  result.push(f ? f(o[name], name, index, o) : o[name]);
906
1267
  return result;
@@ -932,7 +1293,7 @@ function initJscadutils(_CSG, options = {}) {
932
1293
  function xyz2array(size) {
933
1294
  return [ size.x, size.y, size.z ];
934
1295
  }
935
- const rotationAxes = {
1296
+ var rotationAxes = {
936
1297
  x: [ 1, 0, 0 ],
937
1298
  y: [ 0, 1, 0 ],
938
1299
  z: [ 0, 0, 1 ]
@@ -1010,7 +1371,7 @@ function initJscadutils(_CSG, options = {}) {
1010
1371
  function mirrored4(x) {
1011
1372
  return x.union([ x.mirroredY(90), x.mirroredX(90), x.mirroredY(90).mirroredX(90) ]);
1012
1373
  }
1013
- const flushSide = {
1374
+ var flushSide = {
1014
1375
  "above-outside": [ 1, 0 ],
1015
1376
  "above-inside": [ 1, 1 ],
1016
1377
  "below-outside": [ 0, 1 ],
@@ -1040,7 +1401,8 @@ function initJscadutils(_CSG, options = {}) {
1040
1401
  return w[side[0]][axis] - m[side[1]][axis];
1041
1402
  });
1042
1403
  }
1043
- function calcSnap(moveobj, withobj, axes, orientation, delta = 0) {
1404
+ function calcSnap(moveobj, withobj, axes, orientation) {
1405
+ var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1044
1406
  var side = flushSide[orientation];
1045
1407
  if (!side) {
1046
1408
  var fix = {
@@ -1106,7 +1468,7 @@ function initJscadutils(_CSG, options = {}) {
1106
1468
  objectSize = objectSize || size(bounds);
1107
1469
  return bounds[0].plus(objectSize.dividedBy(2));
1108
1470
  } catch (err) {
1109
- error(`centroid error o:${jscadToString(o)} objectSize: ${objectSize}`, undefined, err);
1471
+ error("centroid error o:".concat(jscadToString(o), " objectSize: ").concat(objectSize), undefined, err);
1110
1472
  }
1111
1473
  }
1112
1474
  function calcmidlineTo(o, axis, to) {
@@ -1127,7 +1489,8 @@ function initJscadutils(_CSG, options = {}) {
1127
1489
  });
1128
1490
  return t;
1129
1491
  }
1130
- function calcCenterWith(o, axes, withObj, delta = 0) {
1492
+ function calcCenterWith(o, axes, withObj) {
1493
+ var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1131
1494
  var objectCentroid = centroid(o);
1132
1495
  var withCentroid = centroid(withObj);
1133
1496
  var t = axisApply(axes, function(i, axis) {
@@ -1149,7 +1512,10 @@ function initJscadutils(_CSG, options = {}) {
1149
1512
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1150
1513
  });
1151
1514
  }
1152
- function bisect(...args) {
1515
+ function bisect() {
1516
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1517
+ args[_key] = arguments[_key];
1518
+ }
1153
1519
  if (args.length < 2) {
1154
1520
  error("bisect requires an object and an axis", "JSCAD_UTILS_INVALID_ARGS");
1155
1521
  }
@@ -1230,10 +1596,14 @@ function initJscadutils(_CSG, options = {}) {
1230
1596
  if (options.addRotationCenter) g.add(unitAxis(objectSize.length() + 10, .1, rotationCenter), "rotationCenter");
1231
1597
  return g;
1232
1598
  }
1233
- function slice(object, angle = 15, axis = "x", rotateaxis = "z", options = {
1234
- color: true,
1235
- addRotationCenter: true
1236
- }) {
1599
+ function slice(object) {
1600
+ var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;
1601
+ var axis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "x";
1602
+ var rotateaxis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "z";
1603
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
1604
+ color: true,
1605
+ addRotationCenter: true
1606
+ };
1237
1607
  var info = normalVector(axis);
1238
1608
  var rotationCenter = options.rotationCenter || new CSG.Vector3D(0, 0, 0);
1239
1609
  var theRotationAxis = rotationAxes[rotateaxis];
@@ -1450,11 +1820,12 @@ function initJscadutils(_CSG, options = {}) {
1450
1820
  };
1451
1821
  }
1452
1822
  function rotateAround(part, solid, axis, angle) {
1453
- var {rotationCenter, rotationAxis} = calcRotate(part, solid, axis);
1823
+ var _calcRotate = calcRotate(part, solid, axis), rotationCenter = _calcRotate.rotationCenter, rotationAxis = _calcRotate.rotationAxis;
1454
1824
  return part.rotate(rotationCenter, rotationAxis, angle);
1455
1825
  }
1456
- function cloneProperties(from, to, depth = 0) {
1457
- return Object.entries(from).reduce((props, [key, value]) => {
1826
+ function cloneProperties(from, to) {
1827
+ return Object.entries(from).reduce(function(props, _ref) {
1828
+ var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1458
1829
  props[key] = value;
1459
1830
  return props;
1460
1831
  }, to);
@@ -1465,85 +1836,14 @@ function initJscadutils(_CSG, options = {}) {
1465
1836
  debug$2("clone", o, c, CSG);
1466
1837
  return c;
1467
1838
  }
1468
- function addConnector(object, name, point = [ 0, 0, 0 ], axis = [ 1, 0, 0 ], normal = [ 0, 0, 1 ]) {
1839
+ function addConnector(object, name) {
1840
+ var point = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [ 0, 0, 0 ];
1841
+ var axis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [ 1, 0, 0 ];
1842
+ var normal = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [ 0, 0, 1 ];
1469
1843
  object.properties[name] = new CSG.Connector(point, axis, normal);
1470
1844
  return object;
1471
1845
  }
1472
- var util = Object.freeze({
1473
- __proto__: null,
1474
- NOZZEL_SIZE,
1475
- addConnector,
1476
- axis2array,
1477
- axisApply,
1478
- bisect,
1479
- calcCenterWith,
1480
- calcFlush,
1481
- calcRotate,
1482
- calcSnap,
1483
- calcmidlineTo,
1484
- center,
1485
- centerWith,
1486
- centerX,
1487
- centerY,
1488
- centroid,
1489
- chamfer,
1490
- clone,
1491
- cm,
1492
- defaults,
1493
- depreciated,
1494
- div,
1495
- divA,
1496
- divxyz,
1497
- enlarge,
1498
- error,
1499
- fillet,
1500
- fit,
1501
- flush,
1502
- flushSide,
1503
- getDelta,
1504
- identity,
1505
- ifArray,
1506
- inch,
1507
- isEmpty,
1508
- isNegative,
1509
- jscadToString,
1510
- label,
1511
- map,
1512
- mapPick,
1513
- mapValues,
1514
- midlineTo,
1515
- mirrored4,
1516
- mul,
1517
- mulxyz,
1518
- nearest,
1519
- normalVector,
1520
- pick,
1521
- poly2solid,
1522
- print,
1523
- reShape,
1524
- result,
1525
- rotateAround,
1526
- rotationAxes,
1527
- scale,
1528
- segment,
1529
- shift,
1530
- size,
1531
- slice,
1532
- sliceParams,
1533
- slices2poly,
1534
- snap,
1535
- stretch,
1536
- text,
1537
- toArray,
1538
- translator,
1539
- unitAxis,
1540
- unitCube,
1541
- wedge,
1542
- xyz2array,
1543
- zero,
1544
- zipObject
1545
- });
1546
- const debug$1 = Debug("jscadUtils:parts");
1846
+ var debug$1 = Debug("jscadUtils:parts");
1547
1847
  var parts = {
1548
1848
  BBox: BBox$1,
1549
1849
  Cube,
@@ -1551,13 +1851,16 @@ function initJscadutils(_CSG, options = {}) {
1551
1851
  Cylinder,
1552
1852
  Cone
1553
1853
  };
1554
- function BBox$1(...objects) {
1854
+ function BBox$1() {
1555
1855
  function box(object) {
1556
1856
  return CSG.cube({
1557
1857
  center: object.centroid(),
1558
1858
  radius: object.size().dividedBy(2)
1559
1859
  });
1560
1860
  }
1861
+ for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1862
+ objects[_key] = arguments[_key];
1863
+ }
1561
1864
  return objects.reduce(function(bbox, part) {
1562
1865
  var object = bbox ? union([ bbox, box(part) ]) : part;
1563
1866
  return box(object);
@@ -1590,7 +1893,8 @@ function initJscadutils(_CSG, options = {}) {
1590
1893
  });
1591
1894
  return roundedcube;
1592
1895
  }
1593
- function Cylinder(diameter, height, options = {}) {
1896
+ function Cylinder(diameter, height) {
1897
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1594
1898
  debug$1("parts.Cylinder", diameter, height, options);
1595
1899
  options = Object.assign({
1596
1900
  start: [ 0, 0, 0 ],
@@ -1600,7 +1904,8 @@ function initJscadutils(_CSG, options = {}) {
1600
1904
  }, options);
1601
1905
  return CSG.cylinder(options);
1602
1906
  }
1603
- function Cone(diameter1, diameter2, height, options = {}) {
1907
+ function Cone(diameter1, diameter2, height) {
1908
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1604
1909
  debug$1("parts.Cone", diameter1, diameter2, height, options);
1605
1910
  return CSG.cylinder(Object.assign({
1606
1911
  start: [ 0, 0, 0 ],
@@ -1629,7 +1934,9 @@ function initJscadutils(_CSG, options = {}) {
1629
1934
  function Tube(outsideDiameter, insideDiameter, height, outsideOptions, insideOptions) {
1630
1935
  return Cylinder(outsideDiameter, height, outsideOptions).subtract(Cylinder(insideDiameter, height, insideOptions || outsideOptions));
1631
1936
  }
1632
- function Anchor(width = 10, height = 10) {
1937
+ function Anchor() {
1938
+ var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
1939
+ var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
1633
1940
  var hole = Cylinder(width, height).Center().color("red");
1634
1941
  var post = Cylinder(height / 2, width * .66).rotateX(90).align(hole, "xz").snap(hole, "y", "inside-").translate([ 0, 0, -height / 6 ]).color("purple");
1635
1942
  return Group({
@@ -1649,7 +1956,7 @@ function initJscadutils(_CSG, options = {}) {
1649
1956
  });
1650
1957
  return board;
1651
1958
  }
1652
- const Hardware = {
1959
+ var Hardware = {
1653
1960
  Orientation: {
1654
1961
  up: {
1655
1962
  head: "outside-",
@@ -1660,7 +1967,7 @@ function initJscadutils(_CSG, options = {}) {
1660
1967
  clear: "inside-"
1661
1968
  }
1662
1969
  },
1663
- Screw: function(head, thread, headClearSpace, options) {
1970
+ Screw: function Screw(head, thread, headClearSpace, options) {
1664
1971
  depreciated("Screw", false, "Use the jscad-hardware screw methods instead");
1665
1972
  options = Object.assign(options, {
1666
1973
  orientation: "up",
@@ -1676,7 +1983,7 @@ function initJscadutils(_CSG, options = {}) {
1676
1983
  }
1677
1984
  return group;
1678
1985
  },
1679
- PanHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1986
+ PanHeadScrew: function PanHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1680
1987
  depreciated("PanHeadScrew", false, "Use the jscad-hardware screw methods instead");
1681
1988
  var head = Cylinder(headDiameter, headLength);
1682
1989
  var thread = Cylinder(diameter, length);
@@ -1685,7 +1992,7 @@ function initJscadutils(_CSG, options = {}) {
1685
1992
  }
1686
1993
  return Hardware.Screw(head, thread, headClearSpace, options);
1687
1994
  },
1688
- HexHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1995
+ HexHeadScrew: function HexHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1689
1996
  depreciated("HexHeadScrew", false, "Use the jscad-hardware screw methods instead");
1690
1997
  var head = Hexagon(headDiameter, headLength);
1691
1998
  var thread = Cylinder(diameter, length);
@@ -1694,7 +2001,7 @@ function initJscadutils(_CSG, options = {}) {
1694
2001
  }
1695
2002
  return Hardware.Screw(head, thread, headClearSpace, options);
1696
2003
  },
1697
- FlatHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
2004
+ FlatHeadScrew: function FlatHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1698
2005
  depreciated("FlatHeadScrew", false, "Use the jscad-hardware screw methods instead");
1699
2006
  var head = Cone(headDiameter, diameter, headLength);
1700
2007
  var thread = Cylinder(diameter, length);
@@ -1706,20 +2013,20 @@ function initJscadutils(_CSG, options = {}) {
1706
2013
  };
1707
2014
  var parts$1 = Object.freeze({
1708
2015
  __proto__: null,
1709
- Anchor,
2016
+ default: parts,
1710
2017
  BBox: BBox$1,
1711
- Board,
1712
- Cone,
1713
2018
  Cube,
2019
+ RoundedCube,
1714
2020
  Cylinder,
1715
- Hardware,
2021
+ Cone,
1716
2022
  Hexagon,
1717
- RoundedCube,
1718
2023
  Triangle,
1719
2024
  Tube,
1720
- default: parts
2025
+ Anchor,
2026
+ Board,
2027
+ Hardware
1721
2028
  });
1722
- const debug = Debug("jscadUtils:boxes");
2029
+ var debug = Debug("jscadUtils:boxes");
1723
2030
  function RabbetJoin(box, thickness, cutHeight) {
1724
2031
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
1725
2032
  return rabbetJoin(box, thickness, cutHeight);
@@ -1732,16 +2039,17 @@ function initJscadutils(_CSG, options = {}) {
1732
2039
  var top = bottom.parts.positive.bisect("z", -thickness);
1733
2040
  return Group("top,middle,bottom", [ top.parts.positive, top.parts.negative.color("green"), bottom.parts.negative ]);
1734
2041
  }
1735
- function Rabett(box, thickness, gap, height, face, options = {}) {
2042
+ function Rabett(box, thickness, gap, height, face) {
2043
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
1736
2044
  debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
1737
2045
  gap = gap || .25;
1738
2046
  var inside = thickness - gap;
1739
2047
  var outside = -thickness + gap;
1740
2048
  debug("inside", inside, "outside", outside);
1741
2049
  var group = Group();
1742
- var {positive: top, negative: lower2_3rd} = box.bisect("z", height, options).parts;
2050
+ var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
1743
2051
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
1744
- var {positive: middle, negative: bottom} = lower2_3rd.bisect("z", lowerBisectHeight, options).parts;
2052
+ var _lower2_3rd$bisect$pa = lower2_3rd.bisect("z", lowerBisectHeight, options).parts, middle = _lower2_3rd$bisect$pa.positive, bottom = _lower2_3rd$bisect$pa.negative;
1745
2053
  var middleTop = middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]));
1746
2054
  group.add(top.union(middleTop), "top");
1747
2055
  var bottomOutline = middle.color("yellow").subtract(middle.color("orange").enlarge([ outside, outside, 0 ])).enlarge([ outside, outside, 0 ]);
@@ -1750,7 +2058,9 @@ function initJscadutils(_CSG, options = {}) {
1750
2058
  group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ])).subtract(middleTop)), "bottom");
1751
2059
  return group;
1752
2060
  }
1753
- const RabettTopBottom = function rabbetTMB(box, thickness, gap = .25, options = {}) {
2061
+ var RabettTopBottom = function rabbetTMB(box, thickness) {
2062
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
2063
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1754
2064
  options = Object.assign({
1755
2065
  removableTop: true,
1756
2066
  removableBottom: true,
@@ -1783,7 +2093,7 @@ function initJscadutils(_CSG, options = {}) {
1783
2093
  }
1784
2094
  return group;
1785
2095
  };
1786
- const CutOut = function cutOut(o, h, box, plug, gap) {
2096
+ var CutOut = function cutOut(o, h, box, plug, gap) {
1787
2097
  gap = gap || .25;
1788
2098
  var s = o.size();
1789
2099
  var cutout = o.intersect(box);
@@ -1801,7 +2111,7 @@ function initJscadutils(_CSG, options = {}) {
1801
2111
  insert: union([ o, top ]).intersect(box).subtract(o).enlarge([ -gap, 0, 0 ]).union(clip.subtract(plug).enlarge(-gap, -gap, 0)).color("blue")
1802
2112
  });
1803
2113
  };
1804
- const Rectangle = function(size, thickness, cb) {
2114
+ var Rectangle = function Rectangle(size, thickness, cb) {
1805
2115
  thickness = thickness || 2;
1806
2116
  var s = div$1(xyz2array(size), 2);
1807
2117
  var r = add(s, thickness);
@@ -1815,7 +2125,7 @@ function initJscadutils(_CSG, options = {}) {
1815
2125
  if (cb) box = cb(box);
1816
2126
  return box;
1817
2127
  };
1818
- const Hollow = function(object, thickness, interiorcb, exteriorcb) {
2128
+ var Hollow = function Hollow(object, thickness, interiorcb, exteriorcb) {
1819
2129
  thickness = thickness || 2;
1820
2130
  var size = -thickness * 2;
1821
2131
  interiorcb = interiorcb || identity;
@@ -1823,7 +2133,7 @@ function initJscadutils(_CSG, options = {}) {
1823
2133
  if (exteriorcb) box = exteriorcb(box);
1824
2134
  return box;
1825
2135
  };
1826
- const BBox = function(o) {
2136
+ var BBox = function BBox(o) {
1827
2137
  depreciated("BBox", true, "Use 'parts.BBox' instead");
1828
2138
  var s = div$1(xyz2array(o.size()), 2);
1829
2139
  return CSG.cube({
@@ -1834,7 +2144,8 @@ function initJscadutils(_CSG, options = {}) {
1834
2144
  function getRadius(o) {
1835
2145
  return div$1(xyz2array(o.size()), 2);
1836
2146
  }
1837
- function rabbetJoin(box, thickness, gap = .25) {
2147
+ function rabbetJoin(box, thickness) {
2148
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
1838
2149
  var r = add(getRadius(box), -thickness / 2);
1839
2150
  r[2] = thickness / 2;
1840
2151
  var cutter = CSG.cube({
@@ -1852,17 +2163,16 @@ function initJscadutils(_CSG, options = {}) {
1852
2163
  }
1853
2164
  var Boxes = Object.freeze({
1854
2165
  __proto__: null,
1855
- BBox,
1856
- CutOut,
1857
- Hollow,
1858
2166
  RabbetJoin,
2167
+ topMiddleBottom,
1859
2168
  Rabett,
1860
2169
  RabettTopBottom,
2170
+ CutOut,
1861
2171
  Rectangle,
1862
- topMiddleBottom
2172
+ Hollow,
2173
+ BBox
1863
2174
  });
1864
- const compatV1 = {
1865
- ...util,
2175
+ var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
1866
2176
  group: Group,
1867
2177
  init: init$1,
1868
2178
  triangle: triUtils,
@@ -1870,7 +2180,7 @@ function initJscadutils(_CSG, options = {}) {
1870
2180
  parts: parts$1,
1871
2181
  Boxes,
1872
2182
  Debug
1873
- };
2183
+ });
1874
2184
  exports.Boxes = Boxes;
1875
2185
  exports.Debug = Debug;
1876
2186
  exports.Group = Group;
@@ -1880,6 +2190,9 @@ function initJscadutils(_CSG, options = {}) {
1880
2190
  exports.parts = parts$1;
1881
2191
  exports.triUtils = triUtils;
1882
2192
  exports.util = util;
2193
+ Object.defineProperty(exports, "__esModule", {
2194
+ value: true
2195
+ });
1883
2196
  return exports;
1884
2197
  }({}, jsCadCSG, scadApi);
1885
2198
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
@@ -1897,7 +2210,7 @@ function initJscadutils(_CSG, options = {}) {
1897
2210
 
1898
2211
  var jscadUtilsPluginInit = [];
1899
2212
 
1900
- util = {
2213
+ var util = {
1901
2214
  init: (...a) => {
1902
2215
  initJscadutils(...a);
1903
2216
  jscadUtilsPluginInit.forEach(p => {