@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.
@@ -69,13 +69,329 @@ function initJscadutils(_CSG, options = {}) {
69
69
  });
70
70
  var jscadUtils = function(exports, jsCadCSG, scadApi) {
71
71
  "use strict";
72
- const toRadians = function toRadians(deg) {
72
+ function _interopDefaultLegacy(e) {
73
+ return e && typeof e === "object" && "default" in e ? e : {
74
+ default: e
75
+ };
76
+ }
77
+ var jsCadCSG__default = _interopDefaultLegacy(jsCadCSG);
78
+ var scadApi__default = _interopDefaultLegacy(scadApi);
79
+ var util = Object.freeze({
80
+ __proto__: null,
81
+ get NOZZEL_SIZE() {
82
+ return NOZZEL_SIZE;
83
+ },
84
+ get nearest() {
85
+ return nearest;
86
+ },
87
+ get identity() {
88
+ return identity;
89
+ },
90
+ get result() {
91
+ return result;
92
+ },
93
+ get defaults() {
94
+ return defaults;
95
+ },
96
+ get isEmpty() {
97
+ return isEmpty;
98
+ },
99
+ get isNegative() {
100
+ return isNegative;
101
+ },
102
+ get print() {
103
+ return print;
104
+ },
105
+ get jscadToString() {
106
+ return jscadToString;
107
+ },
108
+ get error() {
109
+ return error;
110
+ },
111
+ get depreciated() {
112
+ return depreciated;
113
+ },
114
+ get inch() {
115
+ return inch;
116
+ },
117
+ get cm() {
118
+ return cm;
119
+ },
120
+ get label() {
121
+ return label;
122
+ },
123
+ get text() {
124
+ return text;
125
+ },
126
+ get unitCube() {
127
+ return unitCube;
128
+ },
129
+ get unitAxis() {
130
+ return unitAxis;
131
+ },
132
+ get toArray() {
133
+ return toArray;
134
+ },
135
+ get ifArray() {
136
+ return ifArray;
137
+ },
138
+ get segment() {
139
+ return segment;
140
+ },
141
+ get zipObject() {
142
+ return zipObject;
143
+ },
144
+ get map() {
145
+ return map;
146
+ },
147
+ get mapValues() {
148
+ return mapValues;
149
+ },
150
+ get pick() {
151
+ return pick;
152
+ },
153
+ get mapPick() {
154
+ return mapPick;
155
+ },
156
+ get divA() {
157
+ return divA;
158
+ },
159
+ get divxyz() {
160
+ return divxyz;
161
+ },
162
+ get div() {
163
+ return div;
164
+ },
165
+ get mulxyz() {
166
+ return mulxyz;
167
+ },
168
+ get mul() {
169
+ return mul;
170
+ },
171
+ get xyz2array() {
172
+ return xyz2array;
173
+ },
174
+ get rotationAxes() {
175
+ return rotationAxes;
176
+ },
177
+ get size() {
178
+ return size;
179
+ },
180
+ get scale() {
181
+ return scale;
182
+ },
183
+ get center() {
184
+ return center;
185
+ },
186
+ get centerY() {
187
+ return centerY;
188
+ },
189
+ get centerX() {
190
+ return centerX;
191
+ },
192
+ get enlarge() {
193
+ return enlarge;
194
+ },
195
+ get fit() {
196
+ return fit;
197
+ },
198
+ get shift() {
199
+ return shift;
200
+ },
201
+ get zero() {
202
+ return zero;
203
+ },
204
+ get mirrored4() {
205
+ return mirrored4;
206
+ },
207
+ get flushSide() {
208
+ return flushSide;
209
+ },
210
+ get calcFlush() {
211
+ return calcFlush;
212
+ },
213
+ get calcSnap() {
214
+ return calcSnap;
215
+ },
216
+ get snap() {
217
+ return snap;
218
+ },
219
+ get flush() {
220
+ return flush;
221
+ },
222
+ get axisApply() {
223
+ return axisApply;
224
+ },
225
+ get axis2array() {
226
+ return axis2array;
227
+ },
228
+ get centroid() {
229
+ return centroid;
230
+ },
231
+ get calcmidlineTo() {
232
+ return calcmidlineTo;
233
+ },
234
+ get midlineTo() {
235
+ return midlineTo;
236
+ },
237
+ get translator() {
238
+ return translator;
239
+ },
240
+ get calcCenterWith() {
241
+ return calcCenterWith;
242
+ },
243
+ get centerWith() {
244
+ return centerWith;
245
+ },
246
+ get getDelta() {
247
+ return getDelta;
248
+ },
249
+ get bisect() {
250
+ return bisect;
251
+ },
252
+ get slice() {
253
+ return slice;
254
+ },
255
+ get wedge() {
256
+ return wedge;
257
+ },
258
+ get stretch() {
259
+ return stretch;
260
+ },
261
+ get poly2solid() {
262
+ return poly2solid;
263
+ },
264
+ get slices2poly() {
265
+ return slices2poly;
266
+ },
267
+ get normalVector() {
268
+ return normalVector;
269
+ },
270
+ get sliceParams() {
271
+ return sliceParams;
272
+ },
273
+ get reShape() {
274
+ return reShape;
275
+ },
276
+ get chamfer() {
277
+ return chamfer;
278
+ },
279
+ get fillet() {
280
+ return fillet;
281
+ },
282
+ get calcRotate() {
283
+ return calcRotate;
284
+ },
285
+ get rotateAround() {
286
+ return rotateAround;
287
+ },
288
+ get clone() {
289
+ return clone;
290
+ },
291
+ get addConnector() {
292
+ return addConnector;
293
+ }
294
+ });
295
+ function _arrayLikeToArray(r, a) {
296
+ (null == a || a > r.length) && (a = r.length);
297
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
298
+ return n;
299
+ }
300
+ function _arrayWithHoles(r) {
301
+ if (Array.isArray(r)) return r;
302
+ }
303
+ function _defineProperty(e, r, t) {
304
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
305
+ value: t,
306
+ enumerable: !0,
307
+ configurable: !0,
308
+ writable: !0
309
+ }) : e[r] = t, e;
310
+ }
311
+ function _iterableToArrayLimit(r, l) {
312
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
313
+ if (null != t) {
314
+ var e, n, i, u, a = [], f = !0, o = !1;
315
+ try {
316
+ if (i = (t = t.call(r)).next, 0 === l) {
317
+ if (Object(t) !== t) return;
318
+ f = !1;
319
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
320
+ } catch (r) {
321
+ o = !0, n = r;
322
+ } finally {
323
+ try {
324
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
325
+ } finally {
326
+ if (o) throw n;
327
+ }
328
+ }
329
+ return a;
330
+ }
331
+ }
332
+ function _nonIterableRest() {
333
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
334
+ }
335
+ function ownKeys(e, r) {
336
+ var t = Object.keys(e);
337
+ if (Object.getOwnPropertySymbols) {
338
+ var o = Object.getOwnPropertySymbols(e);
339
+ r && (o = o.filter(function(r) {
340
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
341
+ })), t.push.apply(t, o);
342
+ }
343
+ return t;
344
+ }
345
+ function _objectSpread2(e) {
346
+ for (var r = 1; r < arguments.length; r++) {
347
+ var t = null != arguments[r] ? arguments[r] : {};
348
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
349
+ _defineProperty(e, r, t[r]);
350
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
351
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
352
+ });
353
+ }
354
+ return e;
355
+ }
356
+ function _slicedToArray(r, e) {
357
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
358
+ }
359
+ function _toPrimitive(t, r) {
360
+ if ("object" != typeof t || !t) return t;
361
+ var e = t[Symbol.toPrimitive];
362
+ if (void 0 !== e) {
363
+ var i = e.call(t, r || "default");
364
+ if ("object" != typeof i) return i;
365
+ throw new TypeError("@@toPrimitive must return a primitive value.");
366
+ }
367
+ return ("string" === r ? String : Number)(t);
368
+ }
369
+ function _toPropertyKey(t) {
370
+ var i = _toPrimitive(t, "string");
371
+ return "symbol" == typeof i ? i : i + "";
372
+ }
373
+ function _typeof(o) {
374
+ "@babel/helpers - typeof";
375
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
376
+ return typeof o;
377
+ } : function(o) {
378
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
379
+ }, _typeof(o);
380
+ }
381
+ function _unsupportedIterableToArray(r, a) {
382
+ if (r) {
383
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
384
+ var t = {}.toString.call(r).slice(8, -1);
385
+ 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;
386
+ }
387
+ }
388
+ var toRadians = function toRadians(deg) {
73
389
  return deg / 180 * Math.PI;
74
390
  };
75
- const toDegrees = function toDegrees(rad) {
391
+ var toDegrees = function toDegrees(rad) {
76
392
  return rad * (180 / Math.PI);
77
393
  };
78
- const solve = function(p1, p2) {
394
+ var solve = function solve(p1, p2) {
79
395
  var r = {
80
396
  c: 90,
81
397
  A: Math.abs(p2.x - p1.x),
@@ -87,7 +403,7 @@ function initJscadutils(_CSG, options = {}) {
87
403
  r.a = 90 - r.b;
88
404
  return r;
89
405
  };
90
- const solve90SA = function(r) {
406
+ var solve90SA = function solve90SA(r) {
91
407
  r = Object.assign(r, {
92
408
  C: 90
93
409
  });
@@ -99,7 +415,7 @@ function initJscadutils(_CSG, options = {}) {
99
415
  r.b = r.b || r.a / Math.tan(arad);
100
416
  return r;
101
417
  };
102
- const solve90ac = function(r) {
418
+ var solve90ac = function solve90ac(r) {
103
419
  r = Object.assign(r, {
104
420
  C: 90
105
421
  });
@@ -120,29 +436,29 @@ function initJscadutils(_CSG, options = {}) {
120
436
  }
121
437
  var triUtils = Object.freeze({
122
438
  __proto__: null,
439
+ toRadians,
440
+ toDegrees,
123
441
  solve,
124
442
  solve90SA,
125
443
  solve90ac,
126
- solveab,
127
- toDegrees,
128
- toRadians
444
+ solveab
129
445
  });
130
- const div$1 = function(a, f) {
446
+ var div$1 = function div(a, f) {
131
447
  return a.map(function(e) {
132
448
  return e / f;
133
449
  });
134
450
  };
135
- const addValue = function(a, f) {
451
+ var addValue = function addValue(a, f) {
136
452
  return a.map(function(e) {
137
453
  return e + f;
138
454
  });
139
455
  };
140
- const addArray = function(a, f) {
456
+ var addArray = function addArray(a, f) {
141
457
  return a.map(function(e, i) {
142
458
  return e + f[i];
143
459
  });
144
460
  };
145
- const add = function(a) {
461
+ var add = function add(a) {
146
462
  return Array.prototype.slice.call(arguments, 1).reduce(function(result, arg) {
147
463
  if (Array.isArray(arg)) {
148
464
  result = addArray(result, arg);
@@ -152,28 +468,28 @@ function initJscadutils(_CSG, options = {}) {
152
468
  return result;
153
469
  }, a);
154
470
  };
155
- const fromxyz = function(object) {
471
+ var fromxyz = function fromxyz(object) {
156
472
  return Array.isArray(object) ? object : [ object.x, object.y, object.z ];
157
473
  };
158
- const toxyz = function(a) {
474
+ var toxyz = function toxyz(a) {
159
475
  return {
160
476
  x: a[0],
161
477
  y: a[1],
162
478
  z: a[2]
163
479
  };
164
480
  };
165
- const first = function(a) {
481
+ var first = function first(a) {
166
482
  return a ? a[0] : undefined;
167
483
  };
168
- const last = function(a) {
484
+ var last = function last(a) {
169
485
  return a && a.length > 0 ? a[a.length - 1] : undefined;
170
486
  };
171
- const min = function(a) {
487
+ var min = function min(a) {
172
488
  return a.reduce(function(result, value) {
173
489
  return value < result ? value : result;
174
490
  }, Number.MAX_VALUE);
175
491
  };
176
- const range = function(a, b) {
492
+ var range = function range(a, b) {
177
493
  var result = [];
178
494
  for (var i = a; i < b; i++) {
179
495
  result.push(i);
@@ -182,21 +498,21 @@ function initJscadutils(_CSG, options = {}) {
182
498
  };
183
499
  var array = Object.freeze({
184
500
  __proto__: null,
185
- add,
186
- addArray,
187
- addValue,
188
501
  div: div$1,
189
- first,
502
+ addValue,
503
+ addArray,
504
+ add,
190
505
  fromxyz,
506
+ toxyz,
507
+ first,
191
508
  last,
192
509
  min,
193
- range,
194
- toxyz
510
+ range
195
511
  });
196
- const debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
197
- 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" ];
512
+ var debugColors = [ "#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999" ];
513
+ 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" ];
198
514
  var debugCount = 0;
199
- const Debug = function(name) {
515
+ var Debug = function Debug(name) {
200
516
  var checks = Object.assign({
201
517
  enabled: [],
202
518
  disabled: [],
@@ -204,21 +520,31 @@ function initJscadutils(_CSG, options = {}) {
204
520
  browser: true
205
521
  }
206
522
  }, jscadUtilsDebug || {});
207
- var style = checks.options.browser ? `color:${debugColors[debugCount++ % debugColors.length]}` : `${termColors[debugCount++ % termColors.length]}`;
523
+ var style = checks.options.browser ? "color:".concat(debugColors[debugCount++ % debugColors.length]) : "".concat(termColors[debugCount++ % termColors.length]);
208
524
  var enabled = checks.enabled.some(function checkEnabled(check) {
209
525
  return check.test(name);
210
526
  }) && !checks.disabled.some(function checkEnabled(check) {
211
527
  return check.test(name);
212
528
  });
213
- var logger = enabled ? checks.options.browser ? (...msg) => {
214
- console.log("%c%s", style, name, ...msg);
215
- } : (...msg) => {
216
- console.log(`${name}`, ...msg);
217
- } : () => undefined;
529
+ var logger = enabled ? checks.options.browser ? function() {
530
+ var _console;
531
+ for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
532
+ msg[_key] = arguments[_key];
533
+ }
534
+ (_console = console).log.apply(_console, [ "%c%s", style, name ].concat(msg));
535
+ } : function() {
536
+ var _console2;
537
+ for (var _len2 = arguments.length, msg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
538
+ msg[_key2] = arguments[_key2];
539
+ }
540
+ (_console2 = console).log.apply(_console2, [ "".concat(name) ].concat(msg));
541
+ } : function() {
542
+ return undefined;
543
+ };
218
544
  logger.enabled = enabled;
219
545
  return logger;
220
546
  };
221
- const nameArray = {
547
+ var nameArray = {
222
548
  aliceblue: "#f0f8ff",
223
549
  antiquewhite: "#faebd7",
224
550
  aqua: "#00ffff",
@@ -380,7 +706,7 @@ function initJscadutils(_CSG, options = {}) {
380
706
  return [ 0, 0, 0 ];
381
707
  }
382
708
  }
383
- const _name2rgb = {};
709
+ var _name2rgb = {};
384
710
  function name2rgb(n) {
385
711
  if (!_name2rgb[n]) _name2rgb[n] = hex2rgb(name2hex(n));
386
712
  return _name2rgb[n];
@@ -460,14 +786,23 @@ function initJscadutils(_CSG, options = {}) {
460
786
  proto.prototype.chamfer = function chamfer$1(radius, orientation, options) {
461
787
  return chamfer(this, radius, orientation, options);
462
788
  };
463
- proto.prototype.bisect = function bisect$1(...args) {
464
- return bisect(this, ...args);
789
+ proto.prototype.bisect = function bisect$1() {
790
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
791
+ args[_key] = arguments[_key];
792
+ }
793
+ return bisect.apply(util, [ this ].concat(args));
465
794
  };
466
- proto.prototype.slice = function slice$1(...args) {
467
- return slice(this, ...args);
795
+ proto.prototype.slice = function slice$1() {
796
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
797
+ args[_key2] = arguments[_key2];
798
+ }
799
+ return slice.apply(util, [ this ].concat(args));
468
800
  };
469
- proto.prototype.wedge = function wedge$1(...args) {
470
- return wedge(this, ...args);
801
+ proto.prototype.wedge = function wedge$1() {
802
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
803
+ args[_key3] = arguments[_key3];
804
+ }
805
+ return wedge.apply(util, [ this ].concat(args));
471
806
  };
472
807
  proto.prototype.stretch = function stretch$1(axis, distance, offset) {
473
808
  return stretch(this, axis, distance, offset);
@@ -484,7 +819,7 @@ function initJscadutils(_CSG, options = {}) {
484
819
  return this._translate(arguments[0]);
485
820
  } else {
486
821
  var t = Array.prototype.slice.call(arguments, 0).reduce(function(result, arg) {
487
- result = undefined.addArray(result, arg);
822
+ result = undefined(result, arg);
488
823
  return result;
489
824
  }, [ 0, 0, 0 ]);
490
825
  return this._translate(t);
@@ -493,10 +828,14 @@ function initJscadutils(_CSG, options = {}) {
493
828
  proto.prototype.addConnector = function addConnector$1(name, point, axis, normal) {
494
829
  return addConnector(this, name, point, axis, normal);
495
830
  };
496
- proto.prototype.connect = function connectTo(myConnectorName, otherConnector, mirror = false, normalrotation = 0) {
497
- var myConnector = myConnectorName.split(".").reduce((a, v) => a[v], this.properties);
831
+ proto.prototype.connect = function connectTo(myConnectorName, otherConnector) {
832
+ var mirror = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
833
+ var normalrotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
834
+ var myConnector = myConnectorName.split(".").reduce(function(a, v) {
835
+ return a[v];
836
+ }, this.properties);
498
837
  if (!myConnector) {
499
- error(`The connector '${myConnectorName}' does not exist on the object [${Object.keys(this.properties).join(",")}]`, "Missing connector property");
838
+ error("The connector '".concat(myConnectorName, "' does not exist on the object [").concat(Object.keys(this.properties).join(","), "]"), "Missing connector property");
500
839
  }
501
840
  return this.connectTo(myConnector, otherConnector, mirror, normalrotation);
502
841
  };
@@ -506,13 +845,16 @@ function initJscadutils(_CSG, options = {}) {
506
845
  __proto__: null,
507
846
  default: init
508
847
  });
509
- const {CSG, CAG} = jsCadCSG;
510
- const {rectangular_extrude} = scadApi.extrusions;
511
- const {vector_text, vector_char} = scadApi.text;
512
- const {union} = scadApi.booleanOps;
848
+ var CSG = jsCadCSG__default["default"].CSG, CAG = jsCadCSG__default["default"].CAG;
849
+ var rectangular_extrude = scadApi__default["default"].extrusions.rectangular_extrude;
850
+ var _scadApi$text = scadApi__default["default"].text, vector_text = _scadApi$text.vector_text, vector_char = _scadApi$text.vector_char;
851
+ var union = scadApi__default["default"].booleanOps.union;
513
852
  init(CSG);
514
- const debug$3 = Debug("jscadUtils:group");
515
- function JsCadUtilsGroup(names = [], parts = {}, holes = []) {
853
+ var debug$3 = Debug("jscadUtils:group");
854
+ function JsCadUtilsGroup() {
855
+ var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
856
+ var parts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
857
+ var holes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
516
858
  this.name = "";
517
859
  this.names = names;
518
860
  this.parts = parts;
@@ -540,7 +882,11 @@ function initJscadutils(_CSG, options = {}) {
540
882
  }
541
883
  return self;
542
884
  };
543
- JsCadUtilsGroup.prototype.combine = function(pieces, options = {}, map = x => x) {
885
+ JsCadUtilsGroup.prototype.combine = function(pieces) {
886
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
887
+ var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function(x) {
888
+ return x;
889
+ };
544
890
  try {
545
891
  var self = this;
546
892
  options = Object.assign({
@@ -548,7 +894,7 @@ function initJscadutils(_CSG, options = {}) {
548
894
  }, options);
549
895
  pieces = pieces ? pieces.split(",") : self.names;
550
896
  if (pieces.length === 0) {
551
- throw new Error(`no pieces found in ${self.name} pieces: ${pieces} parts: ${Object.keys(self.parts)} names: ${self.names}`);
897
+ throw new Error("no pieces found in ".concat(self.name, " pieces: ").concat(pieces, " parts: ").concat(Object.keys(self.parts), " names: ").concat(self.names));
552
898
  }
553
899
  debug$3("combine", self.names, self.parts);
554
900
  var g = union(mapPick(self.parts, pieces, function(value, key, index, object) {
@@ -558,12 +904,14 @@ function initJscadutils(_CSG, options = {}) {
558
904
  return g.subtractIf(self.holes && Array.isArray(self.holes) ? union(self.holes) : self.holes, self.holes && !options.noholes);
559
905
  } catch (err) {
560
906
  debug$3("combine error", this, pieces, options, err);
561
- 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");
907
+ 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");
562
908
  }
563
909
  };
564
910
  JsCadUtilsGroup.prototype.map = function(cb) {
565
911
  var self = this;
566
- self.parts = Object.keys(self.parts).filter(k => k !== "holes").reduce(function(result, key) {
912
+ self.parts = Object.keys(self.parts).filter(function(k) {
913
+ return k !== "holes";
914
+ }).reduce(function(result, key) {
567
915
  result[key] = cb(self.parts[key], key);
568
916
  return result;
569
917
  }, {});
@@ -579,7 +927,7 @@ function initJscadutils(_CSG, options = {}) {
579
927
  return self;
580
928
  };
581
929
  JsCadUtilsGroup.prototype.clone = function(name, map) {
582
- debug$3("clone", name, typeof name, map);
930
+ debug$3("clone", name, _typeof(name), map);
583
931
  var self = this;
584
932
  if (typeof name == "function") {
585
933
  map = name;
@@ -631,7 +979,7 @@ function initJscadutils(_CSG, options = {}) {
631
979
  return self;
632
980
  } catch (err) {
633
981
  debug$3("snap error", this, part, to, axis, delta, err);
634
- 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");
982
+ 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");
635
983
  }
636
984
  };
637
985
  JsCadUtilsGroup.prototype.align = function align(part, to, axis, delta) {
@@ -646,7 +994,7 @@ function initJscadutils(_CSG, options = {}) {
646
994
  return self;
647
995
  } catch (err) {
648
996
  debug$3("align error", this, part, to, axis, delta, err);
649
- 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");
997
+ 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");
650
998
  }
651
999
  };
652
1000
  JsCadUtilsGroup.prototype.center = function center(part) {
@@ -658,7 +1006,9 @@ function initJscadutils(_CSG, options = {}) {
658
1006
  var bounds = self.parts[part].getBounds();
659
1007
  return self.translate([ 0, 0, -bounds[0].z ]);
660
1008
  };
661
- JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName, mirror = true, normalrotation = 0) {
1009
+ JsCadUtilsGroup.prototype.connectTo = function connectTo(partName, connectorName, to, toConnectorName) {
1010
+ var mirror = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1011
+ var normalrotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
662
1012
  debug$3("connectTo", {
663
1013
  partName,
664
1014
  connectorName,
@@ -668,9 +1018,13 @@ function initJscadutils(_CSG, options = {}) {
668
1018
  normalrotation
669
1019
  });
670
1020
  var self = this;
671
- var myConnector = connectorName.split(".").reduce((a, v) => a[v], self.parts[partName].properties);
1021
+ var myConnector = connectorName.split(".").reduce(function(a, v) {
1022
+ return a[v];
1023
+ }, self.parts[partName].properties);
672
1024
  debug$3("toConnector", to instanceof CSG.Connector);
673
- var toConnector = toConnectorName.split(".").reduce((a, v) => a[v], to.properties);
1025
+ var toConnector = toConnectorName.split(".").reduce(function(a, v) {
1026
+ return a[v];
1027
+ }, to.properties);
674
1028
  var matrix = myConnector.getTransformationTo(toConnector, mirror, normalrotation);
675
1029
  debug$3("connectTo", matrix);
676
1030
  self.map(function(part) {
@@ -709,14 +1063,15 @@ function initJscadutils(_CSG, options = {}) {
709
1063
  return g;
710
1064
  };
711
1065
  JsCadUtilsGroup.prototype.array = function(parts, map) {
1066
+ var _this = this;
712
1067
  var self = this;
713
1068
  var p = parts && parts.length > 0 && parts.split(",") || self.names;
714
1069
  if (!map) map = identity;
715
1070
  var a = [];
716
- p.forEach(name => {
1071
+ p.forEach(function(name) {
717
1072
  if (!self.parts[name]) {
718
- debug$3("array error", this, parts);
719
- throw error(`group::array error "${name}" not found.\nthis: ${this}\nparts: "${parts}"\n`, "JSCAD_UTILS_GROUP_ERROR");
1073
+ debug$3("array error", _this, parts);
1074
+ throw error('group::array error "'.concat(name, '" not found.\nthis: ').concat(_this, '\nparts: "').concat(parts, '"\n'), "JSCAD_UTILS_GROUP_ERROR");
720
1075
  }
721
1076
  a.push(map(CSG.fromPolygons(self.parts[name].toPolygons()), name));
722
1077
  });
@@ -726,12 +1081,12 @@ function initJscadutils(_CSG, options = {}) {
726
1081
  var self = this;
727
1082
  var piecesArray = pieces ? pieces.split(",") : self.names;
728
1083
  return piecesArray.map(function(piece) {
729
- if (!self.parts[piece]) console.error(`Cannot find ${piece} in ${self.names}`);
1084
+ if (!self.parts[piece]) console.error("Cannot find ".concat(piece, " in ").concat(self.names));
730
1085
  return self.parts[piece];
731
1086
  });
732
1087
  };
733
1088
  JsCadUtilsGroup.prototype.toString = function() {
734
- 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}`;
1089
+ 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}");
735
1090
  };
736
1091
  JsCadUtilsGroup.prototype.setName = function(name) {
737
1092
  this.name = name;
@@ -761,7 +1116,9 @@ function initJscadutils(_CSG, options = {}) {
761
1116
  self.name = objectNames;
762
1117
  } else {
763
1118
  var objects = objectNames;
764
- self.names = Object.keys(objects).filter(k => k !== "holes");
1119
+ self.names = Object.keys(objects).filter(function(k) {
1120
+ return k !== "holes";
1121
+ });
765
1122
  self.parts = Object.assign({}, objects);
766
1123
  self.holes = objects.holes;
767
1124
  }
@@ -769,13 +1126,17 @@ function initJscadutils(_CSG, options = {}) {
769
1126
  }
770
1127
  return new JsCadUtilsGroup(self.names, self.parts, self.holes);
771
1128
  }
772
- const debug$2 = Debug("jscadUtils:util");
1129
+ var debug$2 = Debug("jscadUtils:util");
773
1130
  var NOZZEL_SIZE = .4;
774
- const nearest = {
775
- under: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1131
+ var nearest = {
1132
+ under: function under(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;
776
1135
  return (Math.floor(desired / nozzel) + nozzie) * nozzel;
777
1136
  },
778
- over: function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) {
1137
+ over: function over(desired) {
1138
+ var nozzel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NOZZEL_SIZE;
1139
+ var nozzie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
779
1140
  return (Math.ceil(desired / nozzel) + nozzie) * nozzel;
780
1141
  }
781
1142
  };
@@ -803,9 +1164,9 @@ function initJscadutils(_CSG, options = {}) {
803
1164
  debug$2(msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())));
804
1165
  }
805
1166
  function jscadToString(o) {
806
- if (typeof o == "object") {
1167
+ if (_typeof(o) == "object") {
807
1168
  if (o.polygons) {
808
- return `{\npolygons: ${o.polygons.length},\nproperties: "${Object.keys(o.properties)}"\n}\n`;
1169
+ return "{\npolygons: ".concat(o.polygons.length, ',\nproperties: "').concat(Object.keys(o.properties), '"\n}\n');
809
1170
  }
810
1171
  } else {
811
1172
  return o.toString();
@@ -846,12 +1207,12 @@ function initJscadutils(_CSG, options = {}) {
846
1207
  }
847
1208
  function text(text) {
848
1209
  var l = vector_char(0, 0, text);
849
- var char = l.segments.reduce(function(result, segment) {
1210
+ var _char = l.segments.reduce(function(result, segment) {
850
1211
  var path = new CSG.Path2D(segment);
851
1212
  var cag = path.expandToCAG(2);
852
1213
  return result ? result.union(cag) : cag;
853
1214
  }, undefined);
854
- return char;
1215
+ return _char;
855
1216
  }
856
1217
  function unitCube(length, radius) {
857
1218
  radius = radius || .5;
@@ -907,7 +1268,7 @@ function initJscadutils(_CSG, options = {}) {
907
1268
  function mapPick(o, names, f, options) {
908
1269
  return names.reduce(function(result, name, index) {
909
1270
  if (!o[name]) {
910
- throw new Error(`${name} not found in ${options.name}: ${Object.keys(o).join(",")}`);
1271
+ throw new Error("".concat(name, " not found in ").concat(options.name, ": ").concat(Object.keys(o).join(",")));
911
1272
  }
912
1273
  result.push(f ? f(o[name], name, index, o) : o[name]);
913
1274
  return result;
@@ -939,7 +1300,7 @@ function initJscadutils(_CSG, options = {}) {
939
1300
  function xyz2array(size) {
940
1301
  return [ size.x, size.y, size.z ];
941
1302
  }
942
- const rotationAxes = {
1303
+ var rotationAxes = {
943
1304
  x: [ 1, 0, 0 ],
944
1305
  y: [ 0, 1, 0 ],
945
1306
  z: [ 0, 0, 1 ]
@@ -1017,7 +1378,7 @@ function initJscadutils(_CSG, options = {}) {
1017
1378
  function mirrored4(x) {
1018
1379
  return x.union([ x.mirroredY(90), x.mirroredX(90), x.mirroredY(90).mirroredX(90) ]);
1019
1380
  }
1020
- const flushSide = {
1381
+ var flushSide = {
1021
1382
  "above-outside": [ 1, 0 ],
1022
1383
  "above-inside": [ 1, 1 ],
1023
1384
  "below-outside": [ 0, 1 ],
@@ -1047,7 +1408,8 @@ function initJscadutils(_CSG, options = {}) {
1047
1408
  return w[side[0]][axis] - m[side[1]][axis];
1048
1409
  });
1049
1410
  }
1050
- function calcSnap(moveobj, withobj, axes, orientation, delta = 0) {
1411
+ function calcSnap(moveobj, withobj, axes, orientation) {
1412
+ var delta = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1051
1413
  var side = flushSide[orientation];
1052
1414
  if (!side) {
1053
1415
  var fix = {
@@ -1113,7 +1475,7 @@ function initJscadutils(_CSG, options = {}) {
1113
1475
  objectSize = objectSize || size(bounds);
1114
1476
  return bounds[0].plus(objectSize.dividedBy(2));
1115
1477
  } catch (err) {
1116
- error(`centroid error o:${jscadToString(o)} objectSize: ${objectSize}`, undefined, err);
1478
+ error("centroid error o:".concat(jscadToString(o), " objectSize: ").concat(objectSize), undefined, err);
1117
1479
  }
1118
1480
  }
1119
1481
  function calcmidlineTo(o, axis, to) {
@@ -1134,7 +1496,8 @@ function initJscadutils(_CSG, options = {}) {
1134
1496
  });
1135
1497
  return t;
1136
1498
  }
1137
- function calcCenterWith(o, axes, withObj, delta = 0) {
1499
+ function calcCenterWith(o, axes, withObj) {
1500
+ var delta = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1138
1501
  var objectCentroid = centroid(o);
1139
1502
  var withCentroid = centroid(withObj);
1140
1503
  var t = axisApply(axes, function(i, axis) {
@@ -1156,7 +1519,10 @@ function initJscadutils(_CSG, options = {}) {
1156
1519
  return bounds[0][a] + (isEmpty(dist) ? size[axis] / 2 : dist);
1157
1520
  });
1158
1521
  }
1159
- function bisect(...args) {
1522
+ function bisect() {
1523
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1524
+ args[_key] = arguments[_key];
1525
+ }
1160
1526
  if (args.length < 2) {
1161
1527
  error("bisect requires an object and an axis", "JSCAD_UTILS_INVALID_ARGS");
1162
1528
  }
@@ -1237,10 +1603,14 @@ function initJscadutils(_CSG, options = {}) {
1237
1603
  if (options.addRotationCenter) g.add(unitAxis(objectSize.length() + 10, .1, rotationCenter), "rotationCenter");
1238
1604
  return g;
1239
1605
  }
1240
- function slice(object, angle = 15, axis = "x", rotateaxis = "z", options = {
1241
- color: true,
1242
- addRotationCenter: true
1243
- }) {
1606
+ function slice(object) {
1607
+ var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;
1608
+ var axis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "x";
1609
+ var rotateaxis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "z";
1610
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
1611
+ color: true,
1612
+ addRotationCenter: true
1613
+ };
1244
1614
  var info = normalVector(axis);
1245
1615
  var rotationCenter = options.rotationCenter || new CSG.Vector3D(0, 0, 0);
1246
1616
  var theRotationAxis = rotationAxes[rotateaxis];
@@ -1457,11 +1827,12 @@ function initJscadutils(_CSG, options = {}) {
1457
1827
  };
1458
1828
  }
1459
1829
  function rotateAround(part, solid, axis, angle) {
1460
- var {rotationCenter, rotationAxis} = calcRotate(part, solid, axis);
1830
+ var _calcRotate = calcRotate(part, solid, axis), rotationCenter = _calcRotate.rotationCenter, rotationAxis = _calcRotate.rotationAxis;
1461
1831
  return part.rotate(rotationCenter, rotationAxis, angle);
1462
1832
  }
1463
- function cloneProperties(from, to, depth = 0) {
1464
- return Object.entries(from).reduce((props, [key, value]) => {
1833
+ function cloneProperties(from, to) {
1834
+ return Object.entries(from).reduce(function(props, _ref) {
1835
+ var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
1465
1836
  props[key] = value;
1466
1837
  return props;
1467
1838
  }, to);
@@ -1472,85 +1843,14 @@ function initJscadutils(_CSG, options = {}) {
1472
1843
  debug$2("clone", o, c, CSG);
1473
1844
  return c;
1474
1845
  }
1475
- function addConnector(object, name, point = [ 0, 0, 0 ], axis = [ 1, 0, 0 ], normal = [ 0, 0, 1 ]) {
1846
+ function addConnector(object, name) {
1847
+ var point = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [ 0, 0, 0 ];
1848
+ var axis = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [ 1, 0, 0 ];
1849
+ var normal = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [ 0, 0, 1 ];
1476
1850
  object.properties[name] = new CSG.Connector(point, axis, normal);
1477
1851
  return object;
1478
1852
  }
1479
- var util = Object.freeze({
1480
- __proto__: null,
1481
- NOZZEL_SIZE,
1482
- addConnector,
1483
- axis2array,
1484
- axisApply,
1485
- bisect,
1486
- calcCenterWith,
1487
- calcFlush,
1488
- calcRotate,
1489
- calcSnap,
1490
- calcmidlineTo,
1491
- center,
1492
- centerWith,
1493
- centerX,
1494
- centerY,
1495
- centroid,
1496
- chamfer,
1497
- clone,
1498
- cm,
1499
- defaults,
1500
- depreciated,
1501
- div,
1502
- divA,
1503
- divxyz,
1504
- enlarge,
1505
- error,
1506
- fillet,
1507
- fit,
1508
- flush,
1509
- flushSide,
1510
- getDelta,
1511
- identity,
1512
- ifArray,
1513
- inch,
1514
- isEmpty,
1515
- isNegative,
1516
- jscadToString,
1517
- label,
1518
- map,
1519
- mapPick,
1520
- mapValues,
1521
- midlineTo,
1522
- mirrored4,
1523
- mul,
1524
- mulxyz,
1525
- nearest,
1526
- normalVector,
1527
- pick,
1528
- poly2solid,
1529
- print,
1530
- reShape,
1531
- result,
1532
- rotateAround,
1533
- rotationAxes,
1534
- scale,
1535
- segment,
1536
- shift,
1537
- size,
1538
- slice,
1539
- sliceParams,
1540
- slices2poly,
1541
- snap,
1542
- stretch,
1543
- text,
1544
- toArray,
1545
- translator,
1546
- unitAxis,
1547
- unitCube,
1548
- wedge,
1549
- xyz2array,
1550
- zero,
1551
- zipObject
1552
- });
1553
- const debug$1 = Debug("jscadUtils:parts");
1853
+ var debug$1 = Debug("jscadUtils:parts");
1554
1854
  var parts = {
1555
1855
  BBox: BBox$1,
1556
1856
  Cube,
@@ -1558,13 +1858,16 @@ function initJscadutils(_CSG, options = {}) {
1558
1858
  Cylinder,
1559
1859
  Cone
1560
1860
  };
1561
- function BBox$1(...objects) {
1861
+ function BBox$1() {
1562
1862
  function box(object) {
1563
1863
  return CSG.cube({
1564
1864
  center: object.centroid(),
1565
1865
  radius: object.size().dividedBy(2)
1566
1866
  });
1567
1867
  }
1868
+ for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
1869
+ objects[_key] = arguments[_key];
1870
+ }
1568
1871
  return objects.reduce(function(bbox, part) {
1569
1872
  var object = bbox ? union([ bbox, box(part) ]) : part;
1570
1873
  return box(object);
@@ -1597,7 +1900,8 @@ function initJscadutils(_CSG, options = {}) {
1597
1900
  });
1598
1901
  return roundedcube;
1599
1902
  }
1600
- function Cylinder(diameter, height, options = {}) {
1903
+ function Cylinder(diameter, height) {
1904
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1601
1905
  debug$1("parts.Cylinder", diameter, height, options);
1602
1906
  options = Object.assign({
1603
1907
  start: [ 0, 0, 0 ],
@@ -1607,7 +1911,8 @@ function initJscadutils(_CSG, options = {}) {
1607
1911
  }, options);
1608
1912
  return CSG.cylinder(options);
1609
1913
  }
1610
- function Cone(diameter1, diameter2, height, options = {}) {
1914
+ function Cone(diameter1, diameter2, height) {
1915
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1611
1916
  debug$1("parts.Cone", diameter1, diameter2, height, options);
1612
1917
  return CSG.cylinder(Object.assign({
1613
1918
  start: [ 0, 0, 0 ],
@@ -1636,7 +1941,9 @@ function initJscadutils(_CSG, options = {}) {
1636
1941
  function Tube(outsideDiameter, insideDiameter, height, outsideOptions, insideOptions) {
1637
1942
  return Cylinder(outsideDiameter, height, outsideOptions).subtract(Cylinder(insideDiameter, height, insideOptions || outsideOptions));
1638
1943
  }
1639
- function Anchor(width = 10, height = 10) {
1944
+ function Anchor() {
1945
+ var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
1946
+ var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
1640
1947
  var hole = Cylinder(width, height).Center().color("red");
1641
1948
  var post = Cylinder(height / 2, width * .66).rotateX(90).align(hole, "xz").snap(hole, "y", "inside-").translate([ 0, 0, -height / 6 ]).color("purple");
1642
1949
  return Group({
@@ -1656,7 +1963,7 @@ function initJscadutils(_CSG, options = {}) {
1656
1963
  });
1657
1964
  return board;
1658
1965
  }
1659
- const Hardware = {
1966
+ var Hardware = {
1660
1967
  Orientation: {
1661
1968
  up: {
1662
1969
  head: "outside-",
@@ -1667,7 +1974,7 @@ function initJscadutils(_CSG, options = {}) {
1667
1974
  clear: "inside-"
1668
1975
  }
1669
1976
  },
1670
- Screw: function(head, thread, headClearSpace, options) {
1977
+ Screw: function Screw(head, thread, headClearSpace, options) {
1671
1978
  depreciated("Screw", false, "Use the jscad-hardware screw methods instead");
1672
1979
  options = Object.assign(options, {
1673
1980
  orientation: "up",
@@ -1683,7 +1990,7 @@ function initJscadutils(_CSG, options = {}) {
1683
1990
  }
1684
1991
  return group;
1685
1992
  },
1686
- PanHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
1993
+ PanHeadScrew: function PanHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1687
1994
  depreciated("PanHeadScrew", false, "Use the jscad-hardware screw methods instead");
1688
1995
  var head = Cylinder(headDiameter, headLength);
1689
1996
  var thread = Cylinder(diameter, length);
@@ -1692,7 +1999,7 @@ function initJscadutils(_CSG, options = {}) {
1692
1999
  }
1693
2000
  return Hardware.Screw(head, thread, headClearSpace, options);
1694
2001
  },
1695
- HexHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
2002
+ HexHeadScrew: function HexHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1696
2003
  depreciated("HexHeadScrew", false, "Use the jscad-hardware screw methods instead");
1697
2004
  var head = Hexagon(headDiameter, headLength);
1698
2005
  var thread = Cylinder(diameter, length);
@@ -1701,7 +2008,7 @@ function initJscadutils(_CSG, options = {}) {
1701
2008
  }
1702
2009
  return Hardware.Screw(head, thread, headClearSpace, options);
1703
2010
  },
1704
- FlatHeadScrew: function(headDiameter, headLength, diameter, length, clearLength, options) {
2011
+ FlatHeadScrew: function FlatHeadScrew(headDiameter, headLength, diameter, length, clearLength, options) {
1705
2012
  depreciated("FlatHeadScrew", false, "Use the jscad-hardware screw methods instead");
1706
2013
  var head = Cone(headDiameter, diameter, headLength);
1707
2014
  var thread = Cylinder(diameter, length);
@@ -1713,20 +2020,20 @@ function initJscadutils(_CSG, options = {}) {
1713
2020
  };
1714
2021
  var parts$1 = Object.freeze({
1715
2022
  __proto__: null,
1716
- Anchor,
2023
+ default: parts,
1717
2024
  BBox: BBox$1,
1718
- Board,
1719
- Cone,
1720
2025
  Cube,
2026
+ RoundedCube,
1721
2027
  Cylinder,
1722
- Hardware,
2028
+ Cone,
1723
2029
  Hexagon,
1724
- RoundedCube,
1725
2030
  Triangle,
1726
2031
  Tube,
1727
- default: parts
2032
+ Anchor,
2033
+ Board,
2034
+ Hardware
1728
2035
  });
1729
- const debug = Debug("jscadUtils:boxes");
2036
+ var debug = Debug("jscadUtils:boxes");
1730
2037
  function RabbetJoin(box, thickness, cutHeight) {
1731
2038
  depreciated("RabbetJoin", true, "Use 'Rabbet' instead");
1732
2039
  return rabbetJoin(box, thickness, cutHeight);
@@ -1739,16 +2046,17 @@ function initJscadutils(_CSG, options = {}) {
1739
2046
  var top = bottom.parts.positive.bisect("z", -thickness);
1740
2047
  return Group("top,middle,bottom", [ top.parts.positive, top.parts.negative.color("green"), bottom.parts.negative ]);
1741
2048
  }
1742
- function Rabett(box, thickness, gap, height, face, options = {}) {
2049
+ function Rabett(box, thickness, gap, height, face) {
2050
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
1743
2051
  debug("Rabett", "thickness", thickness, "gap", gap, "height", height, "face", face);
1744
2052
  gap = gap || .25;
1745
2053
  var inside = thickness - gap;
1746
2054
  var outside = -thickness + gap;
1747
2055
  debug("inside", inside, "outside", outside);
1748
2056
  var group = Group();
1749
- var {positive: top, negative: lower2_3rd} = box.bisect("z", height, options).parts;
2057
+ var _box$bisect$parts = box.bisect("z", height, options).parts, top = _box$bisect$parts.positive, lower2_3rd = _box$bisect$parts.negative;
1750
2058
  var lowerBisectHeight = Math.sign(height) < 0 ? face * Math.sign(height) : height - face;
1751
- var {positive: middle, negative: bottom} = lower2_3rd.bisect("z", lowerBisectHeight, options).parts;
2059
+ var _lower2_3rd$bisect$pa = lower2_3rd.bisect("z", lowerBisectHeight, options).parts, middle = _lower2_3rd$bisect$pa.positive, bottom = _lower2_3rd$bisect$pa.negative;
1752
2060
  var middleTop = middle.color("yellow").subtract(middle.color("darkred").enlarge([ outside, outside, 0 ]));
1753
2061
  group.add(top.union(middleTop), "top");
1754
2062
  var bottomOutline = middle.color("yellow").subtract(middle.color("orange").enlarge([ outside, outside, 0 ])).enlarge([ outside, outside, 0 ]);
@@ -1757,7 +2065,9 @@ function initJscadutils(_CSG, options = {}) {
1757
2065
  group.add(bottom.color("orange").union(middle.color("green").subtract(middle.color("red").enlarge([ inside, inside, 0 ])).subtract(middleTop)), "bottom");
1758
2066
  return group;
1759
2067
  }
1760
- const RabettTopBottom = function rabbetTMB(box, thickness, gap = .25, options = {}) {
2068
+ var RabettTopBottom = function rabbetTMB(box, thickness) {
2069
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
2070
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1761
2071
  options = Object.assign({
1762
2072
  removableTop: true,
1763
2073
  removableBottom: true,
@@ -1790,7 +2100,7 @@ function initJscadutils(_CSG, options = {}) {
1790
2100
  }
1791
2101
  return group;
1792
2102
  };
1793
- const CutOut = function cutOut(o, h, box, plug, gap) {
2103
+ var CutOut = function cutOut(o, h, box, plug, gap) {
1794
2104
  gap = gap || .25;
1795
2105
  var s = o.size();
1796
2106
  var cutout = o.intersect(box);
@@ -1808,7 +2118,7 @@ function initJscadutils(_CSG, options = {}) {
1808
2118
  insert: union([ o, top ]).intersect(box).subtract(o).enlarge([ -gap, 0, 0 ]).union(clip.subtract(plug).enlarge(-gap, -gap, 0)).color("blue")
1809
2119
  });
1810
2120
  };
1811
- const Rectangle = function(size, thickness, cb) {
2121
+ var Rectangle = function Rectangle(size, thickness, cb) {
1812
2122
  thickness = thickness || 2;
1813
2123
  var s = div$1(xyz2array(size), 2);
1814
2124
  var r = add(s, thickness);
@@ -1822,7 +2132,7 @@ function initJscadutils(_CSG, options = {}) {
1822
2132
  if (cb) box = cb(box);
1823
2133
  return box;
1824
2134
  };
1825
- const Hollow = function(object, thickness, interiorcb, exteriorcb) {
2135
+ var Hollow = function Hollow(object, thickness, interiorcb, exteriorcb) {
1826
2136
  thickness = thickness || 2;
1827
2137
  var size = -thickness * 2;
1828
2138
  interiorcb = interiorcb || identity;
@@ -1830,7 +2140,7 @@ function initJscadutils(_CSG, options = {}) {
1830
2140
  if (exteriorcb) box = exteriorcb(box);
1831
2141
  return box;
1832
2142
  };
1833
- const BBox = function(o) {
2143
+ var BBox = function BBox(o) {
1834
2144
  depreciated("BBox", true, "Use 'parts.BBox' instead");
1835
2145
  var s = div$1(xyz2array(o.size()), 2);
1836
2146
  return CSG.cube({
@@ -1841,7 +2151,8 @@ function initJscadutils(_CSG, options = {}) {
1841
2151
  function getRadius(o) {
1842
2152
  return div$1(xyz2array(o.size()), 2);
1843
2153
  }
1844
- function rabbetJoin(box, thickness, gap = .25) {
2154
+ function rabbetJoin(box, thickness) {
2155
+ var gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .25;
1845
2156
  var r = add(getRadius(box), -thickness / 2);
1846
2157
  r[2] = thickness / 2;
1847
2158
  var cutter = CSG.cube({
@@ -1859,17 +2170,16 @@ function initJscadutils(_CSG, options = {}) {
1859
2170
  }
1860
2171
  var Boxes = Object.freeze({
1861
2172
  __proto__: null,
1862
- BBox,
1863
- CutOut,
1864
- Hollow,
1865
2173
  RabbetJoin,
2174
+ topMiddleBottom,
1866
2175
  Rabett,
1867
2176
  RabettTopBottom,
2177
+ CutOut,
1868
2178
  Rectangle,
1869
- topMiddleBottom
2179
+ Hollow,
2180
+ BBox
1870
2181
  });
1871
- const compatV1 = {
1872
- ...util,
2182
+ var compatV1 = _objectSpread2(_objectSpread2({}, util), {}, {
1873
2183
  group: Group,
1874
2184
  init: init$1,
1875
2185
  triangle: triUtils,
@@ -1877,7 +2187,7 @@ function initJscadutils(_CSG, options = {}) {
1877
2187
  parts: parts$1,
1878
2188
  Boxes,
1879
2189
  Debug
1880
- };
2190
+ });
1881
2191
  exports.Boxes = Boxes;
1882
2192
  exports.Debug = Debug;
1883
2193
  exports.Group = Group;
@@ -1887,6 +2197,9 @@ function initJscadutils(_CSG, options = {}) {
1887
2197
  exports.parts = parts$1;
1888
2198
  exports.triUtils = triUtils;
1889
2199
  exports.util = util;
2200
+ Object.defineProperty(exports, "__esModule", {
2201
+ value: true
2202
+ });
1890
2203
  return exports;
1891
2204
  }({}, jsCadCSG, scadApi);
1892
2205
  const debug = jscadUtils.Debug("jscadUtils:initJscadutils");
@@ -1904,7 +2217,7 @@ function initJscadutils(_CSG, options = {}) {
1904
2217
 
1905
2218
  var jscadUtilsPluginInit = [];
1906
2219
 
1907
- util = {
2220
+ var util = {
1908
2221
  init: (...a) => {
1909
2222
  initJscadutils(...a);
1910
2223
  jscadUtilsPluginInit.forEach(p => {