From 9fd74cb27f0a1aca51aebe35ea563da17b32bc84 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 31 Jan 2022 09:33:10 -0500 Subject: [PATCH] remove gcode int/ext macros (unused) and repurpose type system to identify features in gcode output --- src/kiri-mode/fdm/export.js | 13 ++----------- src/kiri-mode/fdm/prepare.js | 4 ++++ src/kiri/conf.js | 4 ---- src/kiri/init.js | 4 ---- src/kiri/print.js | 13 +++++++------ 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/kiri-mode/fdm/export.js b/src/kiri-mode/fdm/export.js index 4d7fce29..cc08b398 100644 --- a/src/kiri-mode/fdm/export.js +++ b/src/kiri-mode/fdm/export.js @@ -26,8 +26,6 @@ gcodeFan = device.gcodeFan, gcodeLayer = device.gcodeLayer, gcodeTrack = device.gcodeTrack, - gcodeExt = device.gcodeExt, - gcodeInt = device.gcodeInt, zMoveMax = device.deviceZMax || 0, tool = 0, fwRetract = device.fwRetract, @@ -576,16 +574,9 @@ } } - // emit gcode macro for changed print region + // emit comment on output type chage if (last && out.type !== last.type) { - switch (out.type) { - case 'ext': - appendAllSub(gcodeExt); - break; - case 'int': - appendAllSub(gcodeInt); - break; - } + append(`; feature ${out.type}`); lastType = out.type; } diff --git a/src/kiri-mode/fdm/prepare.js b/src/kiri-mode/fdm/prepare.js index bd13d0fe..95f1e186 100644 --- a/src/kiri-mode/fdm/prepare.js +++ b/src/kiri-mode/fdm/prepare.js @@ -164,6 +164,8 @@ z: firstLayerHeight / 2 }); + print.setType('brim'); + // output brim points let brimStart = offset < nozzle * 2 ? newPoint(-bedWidth, -bedDepth, 0) : printPoint; printPoint = print.poly2polyEmit(polys, brimStart, (poly, index, count, startPoint) => { @@ -345,6 +347,7 @@ let wipe = true; lastPurgeTool = tool; if (rec) { + print.setType('purge tower'); if (layer.last()) { layer.last().retract = true; } @@ -513,6 +516,7 @@ let wtb = slice.widget.track.box; let beltStart = slice.belt && slice.belt.touch;// && (widgets.length === 1); // output seek to start point between mesh slices if previous data + print.setType('layer'); printPoint = print.slicePrintPath( slice, beltStart ? newPoint(-5000, 5000, 0) : printPoint.sub(offset), diff --git a/src/kiri/conf.js b/src/kiri/conf.js index 4efaf05d..76819f59 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -127,8 +127,6 @@ gcodeLayer: valueOf(cmd.layer || code.layer, []), gcodePre: valueOf(code.pre, []), gcodePost: valueOf(code.post, []), - gcodeExt: valueOf(code.ext, []), - gcodeInt: valueOf(code.int, []), // post processor script of which only one exists // for XYZ.daVinci.Mini.w triggered in kiri.export // in the fdm driver to turn gcode into base64 @@ -287,8 +285,6 @@ maxHeight: 150, gcodePre: [], gcodePost: [], - gcodeExt: [], - gcodeInt: [], gcodeProc: "", gcodeFan: [], gcodeTrack: [], diff --git a/src/kiri/init.js b/src/kiri/init.js index 70aa51d5..e88e9ff6 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -791,8 +791,6 @@ UI.deviceName, UI.gcodePre, UI.gcodePost, - UI.gcodeExt, - UI.gcodeInt, UI.bedDepth, UI.bedWidth, UI.maxHeight, @@ -1685,8 +1683,6 @@ (UI.gcodeLayer = UC.newGCode(LANG.dv_layr_s, {title:LANG.dv_layr_l, modes:FDM, area:gcode})).button, (UI.gcodeTrack = UC.newGCode(LANG.dv_prog_s, {title:LANG.dv_prog_l, modes:FDM, area:gcode})).button, (UI.gcodeFan = UC.newGCode(LANG.dv_fanp_s, {title:LANG.dv_fanp_l, modes:FDM, area:gcode})).button, - (UI.gcodeExt = UC.newGCode(LANG.dv_pext_s, {title:LANG.dv_pext_l, modes:FDM, area:gcode, show:isDanger})).button, - (UI.gcodeInt = UC.newGCode(LANG.dv_pint_s, {title:LANG.dv_pint_l, modes:FDM, area:gcode, show:isDanger})).button, (UI.gcodeLaserOn = UC.newGCode(LANG.dv_lzon_s, {title:LANG.dv_lzon_l, modes:LASER, area:gcode})).button, (UI.gcodeLaserOff = UC.newGCode(LANG.dv_lzof_s, {title:LANG.dv_lzof_l, modes:LASER, area:gcode})).button, (UI.gcodeChange = UC.newGCode(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:CAM, area:gcode})).button, diff --git a/src/kiri/print.js b/src/kiri/print.js index 5c101222..b378dbc2 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -48,6 +48,7 @@ this.id = id || new Date().getTime().toString(36); this.settings = settings; this.widgets = widgets; + this.setType = setType; debugE = settings ? (settings.controller.devel ? 1 : 0) : 0; } @@ -1068,6 +1069,7 @@ let lastTop = null; outputOrderClosest(out, function(next) { if (next instanceof Polygon) { + setType('support'); // support polygon next.setZ(z); outputTraces([next].appendAll(next.inner || [])); @@ -1076,6 +1078,7 @@ outputFills(next.fill, {fast: true}); } } else { + setType('shells'); if (lastTop && lastTop !== next) { retract(); } @@ -1099,9 +1102,6 @@ } } - // flag extrusion type as exterior - setType('ext'); - // innermost shells let inner = next.innerShells() || []; @@ -1113,14 +1113,15 @@ // output outer polygons if (shellOrder === -1) outputTraces(inner, { sort: shellOrder }); - // flag extrusion type as interior - setType('int'); - // output thin fill + setType('thin fill'); outputThin(next.thin_fill); // then output solid and sparse fill + setType('solid fill'); outputFills(next.fill_lines, {flow: solidWidth}); + + setType('sparse infill'); outputSparse(next.fill_sparse, sparseMult, infillSpeed); lastTop = next;