add gcode macros for interior and exterior extrusion
This commit is contained in:
parent
dcca7249d3
commit
9dd8574f9a
6 changed files with 59 additions and 11 deletions
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
// add fields to o(bject) from d(efault) that are missing
|
||||
// remove fields from o(bject) that don't exist in d(efault)
|
||||
function fill_cull_once(obj, def) {
|
||||
function fill_cull_once(obj, def, debug) {
|
||||
if (!obj) return;
|
||||
// handle renaming
|
||||
for (let k in obj) {
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
if (nam !== k) {
|
||||
// handle field renames
|
||||
obj[nam] = obj[k];
|
||||
if (debug) console.log({rename: k, to: nam});
|
||||
delete obj[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -36,15 +37,19 @@
|
|||
let okv = obj[k];
|
||||
if ((okv === undefined || okv === null)) {
|
||||
// handle fill
|
||||
// console.log({fill: k});
|
||||
if (debug) console.log({fill: k, val: def[k]});
|
||||
if (typeof def[k] === 'object') {
|
||||
obj[k] = clone(def[k]);
|
||||
} else {
|
||||
obj[k] = def[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// remove invalid
|
||||
for (let k in obj) {
|
||||
if (!def.hasOwnProperty(k)) {
|
||||
// console.log({cull: k});
|
||||
if (debug) console.log({cull: k});
|
||||
delete obj[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -119,6 +124,8 @@
|
|||
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
|
||||
|
|
@ -266,6 +273,8 @@
|
|||
maxHeight: 150,
|
||||
gcodePre: [],
|
||||
gcodePost: [],
|
||||
gcodeExt: [],
|
||||
gcodeInt: [],
|
||||
gcodePause: [],
|
||||
gcodeProc: "",
|
||||
gcodeFan: [],
|
||||
|
|
|
|||
|
|
@ -752,6 +752,8 @@
|
|||
UI.deviceName,
|
||||
UI.gcodePre,
|
||||
UI.gcodePost,
|
||||
UI.gcodeExt,
|
||||
UI.gcodeInt,
|
||||
UI.gcodePause,
|
||||
UI.bedDepth,
|
||||
UI.bedWidth,
|
||||
|
|
@ -1592,19 +1594,21 @@
|
|||
gcodeFExt: UC.newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LASER, size:7, text:true}),
|
||||
|
||||
gcodeEd: UC.newGroup(LANG.dv_gr_gco, $('dg'), {group:"dgcp", inline:true, modes:GCODE}),
|
||||
gcodeFanTrack: UC.newRow([
|
||||
gcodeMacros: UC.newRow([
|
||||
(UI.gcodePre = UC.newGCode(LANG.dv_head_s, {title:LANG.dv_head_l, modes:GCODE, area:gcode})).button,
|
||||
(UI.gcodePost = UC.newGCode(LANG.dv_foot_s, {title:LANG.dv_foot_l, modes:GCODE, area:gcode})).button,
|
||||
(UI.gcodeFan = UC.newGCode(LANG.dv_fanp_s, {title:LANG.dv_fanp_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.gcodeLayer = UC.newGCode(LANG.dv_layr_s, {title:LANG.dv_layr_l, modes:FDM, area:gcode})).button,
|
||||
(UI.gcodePause = UC.newGCode(LANG.dv_paus_s, {title:LANG.dv_paus_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,
|
||||
(UI.gcodeDwell = UC.newGCode(LANG.dv_dwll_s, {title:LANG.dv_dwll_l, modes:CAM, area:gcode})).button,
|
||||
(UI.gcodeSpindle = UC.newGCode(LANG.dv_sspd_s, {title:LANG.dv_sspd_l, modes:CAM, area:gcode})).button
|
||||
], {class:"ext-buttons f-row"}),
|
||||
], {class:"ext-buttons f-row gcode-macros"}),
|
||||
|
||||
lprefs: UC.newGroup(LANG.op_menu, $('prefs-gen1'), {inline: true}),
|
||||
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}),
|
||||
|
|
|
|||
|
|
@ -2126,14 +2126,17 @@
|
|||
// for each key in setrec object
|
||||
for (let key in setrec) {
|
||||
if (!setrec.hasOwnProperty(key)) {
|
||||
// console.log({no_setrec: key});
|
||||
continue;
|
||||
}
|
||||
if (!uirec.hasOwnProperty(key)) {
|
||||
// console.log({no_uirec: key});
|
||||
continue;
|
||||
}
|
||||
let nval = null, uie = uirec[key];
|
||||
// skip empty UI values
|
||||
if (!uie || uie === '') {
|
||||
// console.log({uie_empty: key});
|
||||
continue;
|
||||
}
|
||||
if (uie.type === 'text') {
|
||||
|
|
@ -2217,7 +2220,7 @@
|
|||
if (opt.controller) {
|
||||
return;
|
||||
}
|
||||
updateSettingsFromFields(device);
|
||||
updateSettingsFromFields(device, undefined, undefined, true);
|
||||
// range-specific values
|
||||
if (settings.mode === 'FDM' && viewMode === VIEWS.SLICE) {
|
||||
let changes = {};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@
|
|||
let lastPoint = null,
|
||||
lastEmit = null,
|
||||
lastOut = null,
|
||||
lastPos;
|
||||
lastPos,
|
||||
nextType;
|
||||
|
||||
KIRI.Print = Print;
|
||||
|
||||
|
|
@ -404,11 +405,16 @@
|
|||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function Output(point, emit, speed, tool) {
|
||||
function Output(point, emit, speed, tool, type) {
|
||||
this.point = point; // point to emit
|
||||
this.emit = emit; // emit (feed for printers, power for lasers, cut for cam)
|
||||
this.speed = speed;
|
||||
this.tool = tool;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
function setType(type) {
|
||||
nextType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -429,8 +435,9 @@
|
|||
// if (emit && emit < 1) console.log(emit);
|
||||
lastPoint = point;
|
||||
lastEmit = emit;
|
||||
lastOut = new Output(point, emit, speed, tool);
|
||||
lastOut = new Output(point, emit, speed, tool, nextType);
|
||||
array.push(lastOut);
|
||||
nextType = undefined;
|
||||
return lastOut;
|
||||
}
|
||||
|
||||
|
|
@ -1049,6 +1056,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
// flag extrusion type as exterior
|
||||
setType('ext');
|
||||
|
||||
// innermost shells
|
||||
let inner = next.innerShells() || [];
|
||||
|
||||
|
|
@ -1060,6 +1070,9 @@
|
|||
// output outer polygons
|
||||
if (shellOrder === -1) outputTraces(inner, { sort: shellOrder });
|
||||
|
||||
// flag extrusion type as interior
|
||||
setType('int');
|
||||
|
||||
// output thin fill
|
||||
outputFills(next.thin_fill, {near: true});
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
gcodeFan = device.gcodeFan,
|
||||
gcodeLayer = device.gcodeLayer,
|
||||
gcodeTrack = device.gcodeTrack,
|
||||
gcodeExt = device.gcodeExt,
|
||||
gcodeInt = device.gcodeInt,
|
||||
tool = 0,
|
||||
fwRetract = device.fwRetract,
|
||||
isDanger = settings.controller.danger,
|
||||
|
|
@ -71,6 +73,7 @@
|
|||
nozzleTemp = process.firstLayerNozzleTemp || process.outputTemp,
|
||||
bedTemp = process.firstLayerBedTemp || process.outputBedTemp,
|
||||
fanSpeed = undefined,
|
||||
lastType = undefined,
|
||||
lastNozzleTemp = nozzleTemp,
|
||||
lastBedTemp = bedTemp,
|
||||
lastFanSpeed = fanSpeed,
|
||||
|
|
@ -142,7 +145,6 @@
|
|||
});
|
||||
}
|
||||
for (let range of process.ranges) {
|
||||
console.log({range});
|
||||
if (range.fields.outputLoops) {
|
||||
rloops.push({
|
||||
start: range.lo,
|
||||
|
|
@ -436,6 +438,19 @@
|
|||
out = path[pidx];
|
||||
speedMMM = (out.speed || process.outputFeedrate) * 60; // range
|
||||
|
||||
// emit gcode macro for changed print region
|
||||
if (out.type !== last.type) {
|
||||
switch (out.type) {
|
||||
case 'ext':
|
||||
appendAllSub(gcodeExt);
|
||||
break;
|
||||
case 'int':
|
||||
appendAllSub(gcodeInt);
|
||||
break;
|
||||
}
|
||||
lastType = out.type;
|
||||
}
|
||||
|
||||
// look for extruder change, run scripts, recalc emit factor
|
||||
if (out.tool !== undefined && out.tool !== tool) {
|
||||
appendAllSub(extruder.extDeselect);
|
||||
|
|
|
|||
|
|
@ -131,6 +131,10 @@ kiri.lang['en-us'] = {
|
|||
dv_head_l: "gcode header script",
|
||||
dv_foot_s: "footer",
|
||||
dv_foot_l: "gcode footer script",
|
||||
dv_pext_s: "exterior",
|
||||
dv_pext_l: ["gcode script run before","printing exterior lines"],
|
||||
dv_pint_s: "interior",
|
||||
dv_pint_l: ["gcode script run before","printing interior lines"],
|
||||
dv_lzon_s: "laser on",
|
||||
dv_lzon_l: "gcode laser on script",
|
||||
dv_lzof_s: "laser off",
|
||||
|
|
|
|||
Loading…
Reference in a new issue