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