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