diff --git a/src/kiri/init.js b/src/kiri/init.js index acef6b84..0e0d50c2 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -916,6 +916,7 @@ API.function.clear(); API.conf.save(); showDevices(); + API.modal.hide(); }; UI.deviceAdd.onclick = function() { API.function.clear(); diff --git a/src/kiri/print.js b/src/kiri/print.js index e3b1e48f..4f1f2fff 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -124,6 +124,7 @@ let dz = 0, abs = true, absE = true, + belt = false, defh = 0, height = 0, factor = 1, @@ -216,6 +217,9 @@ defh = parseFloat(hd[4]); if (fdm) dz = -defh / 2; } + if (line.indexOf("BED TYPE: BELT") > 0) { + belt = true; + } line = line.split(";")[0].split(" ").filter(v => v); let cmd = line.shift(); if (!cmd) return; @@ -270,6 +274,7 @@ scope.lines = lines.length; scope.bytes = gcode.length; scope.maxSpeed = Math.floor(maxf / 60); + scope.belt = belt; done({ output: scope.output }); }; diff --git a/src/mode/fdm/slice.js b/src/mode/fdm/slice.js index ce63036b..b53ad6dc 100644 --- a/src/mode/fdm/slice.js +++ b/src/mode/fdm/slice.js @@ -201,7 +201,9 @@ ) && !vaseMode; doShells(slice, spro.sliceShells, firstOffset, shellOffset, fillOffset, { vase: vaseMode, - thin: spro.detectThinWalls + thin: spro.detectThinWalls, + belt0: sdev.bedBelt && slice.index === 0, + widget: widget }); if (solid) { doSolidLayerFill(slice, fillSpacing, sliceFillAngle); @@ -358,8 +360,7 @@ * @param {number} fillOffset * @param {Obejct} options */ - function doShells(slice, count, offset1, offsetN, fillOffset, options) { - const opt = options || {}; + function doShells(slice, count, offset1, offsetN, fillOffset, opt = {}) { slice.tops.forEach(function(top) { let top_poly = [ top.poly ]; @@ -464,6 +465,14 @@ // for diffing top.last = last; + + if (opt.belt0 && top.shells.length === 0) { + let bounds = opt.widget.bounds; + top.shells.push(BASE.newPolygon() + .setOpen() + .add(bounds.min.x - 5,0,slice.z) + .add(bounds.max.x + 5,0,slice.z)); + } }); };