update laser driver code format
This commit is contained in:
parent
836d53aad5
commit
e22fe7d483
1 changed files with 613 additions and 615 deletions
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
// dep: base.polygons
|
||||
// dep: base.point
|
||||
// dep: kiri.slice
|
||||
gapp.register("kiri-mode.laser.driver", [], (root, exports) => {
|
||||
|
||||
if (!self.kiri.driver) self.kiri.driver = { };
|
||||
if (self.kiri.driver.LASER) return;
|
||||
const { base, kiri } = root;
|
||||
const { driver, newSlice } = kiri;
|
||||
const { FDM, CAM } = driver;
|
||||
const { polygons, newPoint } = base;
|
||||
|
||||
let KIRI = self.kiri,
|
||||
BASE = self.base,
|
||||
UTIL = BASE.util,
|
||||
POLY = BASE.polygons,
|
||||
FDM = KIRI.driver.FDM,
|
||||
CAM = KIRI.driver.CAM,
|
||||
LASER = KIRI.driver.LASER = {
|
||||
const POLY = polygons;
|
||||
const LASER = driver.LASER = {
|
||||
init,
|
||||
slice,
|
||||
prepare,
|
||||
|
|
@ -21,14 +21,12 @@
|
|||
exportGCode,
|
||||
exportSVG,
|
||||
exportDXF
|
||||
},
|
||||
newSlice = KIRI.newSlice,
|
||||
newPoint = BASE.newPoint;
|
||||
};
|
||||
|
||||
function init(kiri, api) {
|
||||
api.event.on("settings.saved", (settings) => {
|
||||
let UI = kiri.api.ui;
|
||||
UI.knife.marker.style.display = UI.knifeOn.checked ? '' : 'none';
|
||||
let ui = kiri.api.ui;
|
||||
ui.knife.marker.style.display = ui.knifeOn.checked ? '' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +52,7 @@
|
|||
let points = widget.getPoints();
|
||||
let indices = [];
|
||||
|
||||
BASE.slice(points, {
|
||||
base.slice(points, {
|
||||
zMin: bounds.min.z,
|
||||
zMax: bounds.max.z,
|
||||
zGen(zopt) {
|
||||
|
|
@ -175,7 +173,7 @@
|
|||
function prepare(widgets, settings, update) {
|
||||
let device = settings.device,
|
||||
process = settings.process,
|
||||
print = self.worker.print = KIRI.newPrint(settings, widgets),
|
||||
print = self.worker.print = kiri.newPrint(settings, widgets),
|
||||
knifeOn = process.knifeOn,
|
||||
knifeDepth = process.outputKnifeDepth,
|
||||
knifePasses = process.outputKnifePasses,
|
||||
|
|
@ -201,7 +199,7 @@
|
|||
out.push( center.projectOnSlope(s1, knifeTipOff) );
|
||||
}
|
||||
while (ticks-- > 0) {
|
||||
out.push( center.projectOnSlope(BASE.newSlopeFromAngle(a1 + off), knifeTipOff) );
|
||||
out.push( center.projectOnSlope(base.newSlopeFromAngle(a1 + off), knifeTipOff) );
|
||||
a1 += step * dir;
|
||||
}
|
||||
out.push( center.projectOnSlope(s2, knifeTipOff) );
|
||||
|
|
@ -342,14 +340,14 @@
|
|||
dh = device.bedDepth / 2,
|
||||
sort = !process.outputLaserLayer,
|
||||
// sort objects by size when not using laser layer ordering
|
||||
c = sort ? output.sort(KIRI.Sort) : output,
|
||||
p = new KIRI.Pack(dw, dh, process.outputTileSpacing).fit(c, !sort);
|
||||
c = sort ? output.sort(kiri.Sort) : output,
|
||||
p = new kiri.Pack(dw, dh, process.outputTileSpacing).fit(c, !sort);
|
||||
|
||||
// test different ratios until packed
|
||||
while (!p.packed) {
|
||||
dw *= 1.1;
|
||||
dh *= 1.1;
|
||||
p = new KIRI.Pack(dw, dh, process.outputTileSpacing).fit(c ,!sort);
|
||||
p = new kiri.Pack(dw, dh, process.outputTileSpacing).fit(c ,!sort);
|
||||
}
|
||||
|
||||
if (pack)
|
||||
|
|
@ -591,7 +589,7 @@
|
|||
},
|
||||
function(point) {
|
||||
z = point.z;
|
||||
return UTIL.round(point.x - dx, 3) + "," + UTIL.round(my - point.y - dy, 3);
|
||||
return util.round(point.x - dx, 3) + "," + util.round(my - point.y - dy, 3);
|
||||
},
|
||||
function(layer, z, thick, layers) {
|
||||
if (zcolor) {
|
||||
|
|
@ -675,4 +673,4 @@
|
|||
return lines.join('\n');
|
||||
};
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue