@jwc/jscad-utils 5.0.1 → 5.1.0

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