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